summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-07-20 12:41:35 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-07-20 12:41:35 +0000
commita7c3554f40b6b017a4d4abc396de64ed89342a62 (patch)
tree423af9b1f3f794da03455fc6c27347eea9c3e173 /java
parentff57e03478b2d6460aa2c60110ddfd976c21ca00 (diff)
downloadlasso-a7c3554f40b6b017a4d4abc396de64ed89342a62.tar.gz
lasso-a7c3554f40b6b017a4d4abc396de64ed89342a62.tar.xz
lasso-a7c3554f40b6b017a4d4abc396de64ed89342a62.zip
Added Java binding.
Diffstat (limited to 'java')
-rw-r--r--java/Makefile42
-rw-r--r--java/Question12
-rw-r--r--java/doc/ImplantationMapping.rst37
-rw-r--r--java/doc/JNIForDummy.rst36
-rw-r--r--java/src/c/Makefile21
-rw-r--r--java/src/c/com_entrouvert_lasso_Lasso.c38
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoAuthnRequest.c153
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoAuthnResponse.c94
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoLogin.c265
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoLogout.c126
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoNode.c36
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoProfileContext.c148
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoProvider.c66
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoRequest.c42
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoResponse.c36
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoServer.c104
-rw-r--r--java/src/c/com_entrouvert_lasso_LassoUser.c61
-rw-r--r--java/src/c/helper.c126
-rw-r--r--java/src/c/helper.h81
-rw-r--r--java/src/java/com/entrouvert/lasso/Lasso.java50
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoAuthnRequest.java64
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoAuthnResponse.java53
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoLogin.java91
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoLogout.java60
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoNode.java51
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoProfileContext.java77
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoProvider.java55
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoRequest.java48
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoResponse.java48
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoServer.java77
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoTest.java53
-rw-r--r--java/src/java/com/entrouvert/lasso/LassoUser.java56
32 files changed, 2307 insertions, 0 deletions
diff --git a/java/Makefile b/java/Makefile
new file mode 100644
index 00000000..c4aec60e
--- /dev/null
+++ b/java/Makefile
@@ -0,0 +1,42 @@
+TARGET=target
+
+JAVAC=/opt/jdk/bin/javac
+JAVAH=/opt/jdk/bin/javah
+JAR=/opt/jdk/bin/jar
+
+JAVA_BUILD_DIR=${TARGET}/classes
+JAVA_SOURCE_DIR=src/java
+JAVA_PACKAGE=com.entrouvert.lasso
+JAVA_SOURCE=${wildcard ${JAVA_SOURCE_DIR}/${subst .,/,${JAVA_PACKAGE}}/*.java}
+JAVA_CLASSES=${addprefix ${JAVA_PACKAGE}., ${filter-out LassoTest, ${basename ${notdir ${JAVA_SOURCE}}}}}
+LASSO.JAR=${TARGET}/lasso.jar
+
+C_SOURCE_DIR=src/c
+C_BUILD_DIR=${C_SOURCE_DIR}
+C_SOURCE=${wildcard ${C_SOURCE_DIR}/*.c}
+C_OBJECT=${C_SOURCE:.c=.o}
+LASSO.SO=${TARGET}/libjlasso.so
+
+.PHONY: clean all binary-java binary-c generate-header
+
+all: binary-java binary-c
+
+binary-java:
+ mkdir -p ${JAVA_BUILD_DIR}
+ ${JAVAC} -d ${JAVA_BUILD_DIR} ${JAVA_SOURCE}
+ ${JAR} cf ${LASSO.JAR} -C ${JAVA_BUILD_DIR} com
+
+generate-header: binary-java
+ ${JAVAH} -d ${C_SOURCE_DIR} -classpath ${JAVA_BUILD_DIR} ${JAVA_CLASSES}
+
+binary-c: ${LASSO.SO}
+
+${C_OBJECT}: ${C_SOURCE}
+ ${MAKE} -C ${C_SOURCE_DIR}
+
+${LASSO.SO}: generate-header ${C_OBJECT}
+ $(CC) -shared ${C_OBJECT} -o $@
+
+clean:
+ ${MAKE} -C ${C_SOURCE_DIR} clean
+ rm -fr ${TARGET} *~ *.log
diff --git a/java/Question b/java/Question
new file mode 100644
index 00000000..9becd97a
--- /dev/null
+++ b/java/Question
@@ -0,0 +1,12 @@
+Q: il faut utiliser lasso_node_destroy ou bien lasso_server_destroy ?
+R: Il faut utiliser lasso_server_destroy.
+
+dans tutorial: lasso_login_process_response
+dans les header: lasso_login_process_response_msg
+
+est-ce que le login.set_user_from_dump est equivalent a un new User(dump) ?
+
+les methodes n'existent que dans le tutorial:
+lasso_authn_request_set_nameIDPolicy
+lasso_logout_handle_request
+
diff --git a/java/doc/ImplantationMapping.rst b/java/doc/ImplantationMapping.rst
new file mode 100644
index 00000000..92b39f65
--- /dev/null
+++ b/java/doc/ImplantationMapping.rst
@@ -0,0 +1,37 @@
+============================
+Implantation du mapping Java
+============================
+
+:author: Benjamin Poussin <poussin@codelutin.com>
+
+La même hierarchie d'objet à été faite dans la mesure du possible entre
+l'implantation C et Java.
+
+Conservation de l'objet C associé à l'objet Java
+================================================
+
+Chaque objet Java hérite d'un objet LassoNode qui contient un champs
+*long c_lasso_object* qui permet de stocker la référence du pointer de
+l'objet C associé à cet objet Java.
+
+Destruction des objets
+======================
+
+L'objet LassoNode contient aussi une méthode finalize qui permet l'appel au
+destructeur de l'objet C, lorsque l'objet java est libéré.
+
+Si une méthode destroy particulière doit-être utilisé pour un objet C, il
+suffit dans l'objet Java de redéfinir la méthode
+*native protected void destroy();* et de l'implanter différement dans
+l'implantation C de la méthode native.
+
+Acces au attribut des objets C
+==============================
+
+Chaque attribut des objets C est accessible par une méthode d'acces. Cette
+méthode se charge de demander la construction de l'objet de représentation
+Java du champs. Ceci est fait par une méthode *init<FieldName>Field*. Cette
+méthode ne modifie l'attribut que si l'objet C et l'objet Java ne sont plus
+synchronisé, c'est à dire si la valeur dans l'objet C à été modifié ou que
+l'objet Java la représentant n'a jamais été créer.
+
diff --git a/java/doc/JNIForDummy.rst b/java/doc/JNIForDummy.rst
new file mode 100644
index 00000000..4f8cd315
--- /dev/null
+++ b/java/doc/JNIForDummy.rst
@@ -0,0 +1,36 @@
+================
+JNI for dummy :)
+================
+
+Sous Linux le nom de la librairie compilée doit obligatoirement commencer par **lib** et
+finir par **.so**.
+
+Pour charger à l'éxécution la librairie elle doit-être dans le
+LD_LIBRAIRY_PATH et en Java il faut la charger avec **System.loadLibrary**::
+
+Par exemple si vous avec généré la librairie libjlasso.so, on la chargera
+avec::
+
+ System.loadLibrary("jlasso");
+
+Pour connaitre le nom de la librairie que le système attend, on peut
+utiliser::
+
+ System.out.println(System.mapLibraryName("jlasso"));
+
+Comment ajouter des fonctions JNI
+=================================
+
+:ref: http://java.sun.com/docs/books/jni/html/jniTOC.html
+:ref: http://gbm.esil.univ-mrs.fr/~tourai/Java/node48.html
+
+Il faut créer les classes Java, et marquer les méthodes qui doivent être
+écrite en C, avec le mot cle native. Ces méthodes n'ont pas de corps en
+Java.
+
+Il faut ensuite exécuter le Makefile se trouvant dans lasso/java pour qu'il
+génère les fichiers d'entête JNI.
+
+Il ne reste plus qu'a reprendre la signature de la méthode et de la coder
+dans le .c
+
diff --git a/java/src/c/Makefile b/java/src/c/Makefile
new file mode 100644
index 00000000..55e6bd03
--- /dev/null
+++ b/java/src/c/Makefile
@@ -0,0 +1,21 @@
+CFLAGS = \
+ -g \
+ -I. -I/opt/jdk/include -I/opt/jdk/include/linux \
+ -I../../.. \
+ -I/usr/include/libxml2 \
+ -I/usr/include/glib-2.0 \
+ -I/usr/lib/glib-2.0/include \
+ -DXMLSEC_LIBXML_260=1 -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -DXMLSEC_CRYPTO_OPENSSL=1 -DXMLSEC_CRYPTO=\"openssl\"
+
+C_SOURCE = ${wildcard *.c}
+C_OBJECT = ${C_SOURCE:.c=.o}
+
+.PHONY: clean all
+
+all: ${C_OBJECT}
+
+%.o: %.c %.h
+ ${CC} $(CFLAGS) -c $<
+
+clean:
+ rm -f ${C_OBJECT} *~
diff --git a/java/src/c/com_entrouvert_lasso_Lasso.c b/java/src/c/com_entrouvert_lasso_Lasso.c
new file mode 100644
index 00000000..6ef512ea
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_Lasso.c
@@ -0,0 +1,38 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <com_entrouvert_lasso_Lasso.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_Lasso_init
+(JNIEnv * env, jclass clazz){
+ return lasso_init();
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_Lasso_shutdown
+(JNIEnv * env, jclass clazz){
+ return lasso_shutdown();
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoAuthnRequest.c b/java/src/c/com_entrouvert_lasso_LassoAuthnRequest.c
new file mode 100644
index 00000000..2069cd2d
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoAuthnRequest.c
@@ -0,0 +1,153 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoAuthnRequest.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_init
+(JNIEnv * env, jobject this, jstring _providerID){
+ LassoNode * request;
+ char * providerID;
+ providerID = (char*)(*env)->GetStringUTFChars(env, _providerID, NULL);
+
+ request = lasso_authn_request_new(providerID);
+
+ (*env)->ReleaseStringUTFChars(env, _providerID, providerID);
+
+ storeCObject(env, this, request);
+}
+
+// From LassoLibAuthnRequest
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setAffiliationID
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_affiliationID((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setassertionConsumerServiceID
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_assertionConsumerServiceID((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setContent
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_consent((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setForceAuthn
+(JNIEnv * env, jobject this, jboolean _value){
+ LassoAuthnRequest * request;
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_forceAuthn((LassoLibAuthnRequest*)request, _value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setPassive
+(JNIEnv * env, jobject this, jboolean _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_isPassive((LassoLibAuthnRequest*)request, _value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setNameIdPolicy
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_nameIDPolicy((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setProtocolProfile
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_protocolProfile((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setproviderID
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_providerID((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnRequest_setRelayState
+(JNIEnv * env, jobject this, jstring _value){
+ LassoAuthnRequest * request;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ request = getCObject(env, this);
+ lasso_lib_authn_request_set_relayState((LassoLibAuthnRequest*)request, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoAuthnResponse.c b/java/src/c/com_entrouvert_lasso_LassoAuthnResponse.c
new file mode 100644
index 00000000..c783e730
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoAuthnResponse.c
@@ -0,0 +1,94 @@
+/* $Id$
+*
+* JLasso -- Java bindings for Lasso library
+*
+* Copyright (C) 2004 Entr'ouvert
+* http://lasso.labs.libre-entreprise.org
+*
+* Authors: Benjamin Poussin <poussin@codelutin.com>
+*
+* This program is free software{} you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation{} either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY{} without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program{} if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoAuthnResponse.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnResponse_init
+(JNIEnv * env, jobject this, jstring _providerID, jobject _request){
+ LassoNode * response;
+ char * providerID;
+ LassoNode * request;
+
+ providerID = (char*)(*env)->GetStringUTFChars(env, _providerID, NULL);
+ request = getCObject(env, _request);
+
+ response = lasso_authn_response_new(providerID, request);
+
+ (*env)->ReleaseStringUTFChars(env, _providerID, providerID);
+
+ storeCObject(env, this, response);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoAuthnResponse_getStatus
+(JNIEnv * env, jobject this){
+ LassoAuthnResponse * response;
+ char* result;
+
+ response = getCObject(env, this);
+ result = lasso_authn_response_get_status(response);
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnResponse_setContent
+(JNIEnv * env, jobject this, jstring _value){
+ LassoLibAuthnResponse * response;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ response = getCObject(env, this);
+ lasso_lib_authn_response_set_consent(response, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnResponse_setProviderID
+(JNIEnv * env, jobject this, jstring _value){
+ LassoLibAuthnResponse * response;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ response = getCObject(env, this);
+ lasso_lib_authn_response_set_providerID(response, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoAuthnResponse_setRelayState
+(JNIEnv * env, jobject this, jstring _value){
+LassoLibAuthnResponse * response;
+ char * value;
+
+ value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
+
+ response = getCObject(env, this);
+ lasso_lib_authn_response_set_relayState(response, value);
+
+ (*env)->ReleaseStringUTFChars(env, _value, value);
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoLogin.c b/java/src/c/com_entrouvert_lasso_LassoLogin.c
new file mode 100644
index 00000000..b544ca2d
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoLogin.c
@@ -0,0 +1,265 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <lasso/lasso.h>
+#include <com_entrouvert_lasso_LassoLogin.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoLogin_init
+(JNIEnv * env, jobject this, jobject _server,
+ jobject _user){
+ LassoLogin *login;
+ LassoServer* server;
+ LassoUser* user = NULL;
+
+ server = (LassoServer*)getCObject(env, _server);
+ if(_user != NULL){
+ user = (LassoUser*)getCObject(env, _user);
+ }
+
+ login = LASSO_LOGIN(lasso_login_new(server, user));
+
+ storeCObject(env, this, login);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoLogin_initFromDump
+(JNIEnv * env, jobject this, jobject _server,
+ jobject _user,
+ jstring _dump){
+ LassoLogin *login;
+ LassoServer* server;
+ char *dump;
+ LassoUser* user = NULL;
+
+ server = (LassoServer*)getCObject(env, _server);
+ if(_user != NULL){
+ user = (LassoUser*)getCObject(env, _user);
+ }
+
+ dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
+ login = LASSO_LOGIN(lasso_login_new_from_dump(server, user, dump));
+ (*env)->ReleaseStringUTFChars(env, _dump, dump);
+
+ storeCObject(env, this, login);
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_buildArtifactMsg
+(JNIEnv * env, jobject this, jint _authenticationResult,
+ jstring _authenticationMethod,
+ jstring _reauthenticateOnOrAfter,
+ jint _method){
+ int result;
+ LassoLogin* login;
+ char *authenticationMethod;
+ char *reauthenticateOnOrAfter;
+
+ authenticationMethod = (char*)(*env)->GetStringUTFChars(env, _authenticationMethod, NULL);
+ reauthenticateOnOrAfter = (char*)(*env)->GetStringUTFChars(env, _reauthenticateOnOrAfter, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_build_artifact_msg(login,
+ _authenticationResult,
+ authenticationMethod,
+ reauthenticateOnOrAfter,
+ _method);
+
+ (*env)->ReleaseStringUTFChars(env, _authenticationMethod, authenticationMethod);
+ (*env)->ReleaseStringUTFChars(env, _reauthenticateOnOrAfter, reauthenticateOnOrAfter);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_buildAuthnRequestMsg
+(JNIEnv * env, jobject this){
+ int result;
+ LassoLogin* login;
+
+ login = getCObject(env, this);
+ result = lasso_login_build_authn_request_msg(login);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_buildAuthnResponseMsg
+(JNIEnv * env, jobject this, jint _authenticationResult,
+ jstring _authenticationMethod,
+ jstring _reauthenticateOnOrAfter){
+ int result;
+ LassoLogin* login;
+ char *authenticationMethod;
+ char *reauthenticateOnOrAfter;
+
+ authenticationMethod = (char*)(*env)->GetStringUTFChars(env, _authenticationMethod, NULL);
+ reauthenticateOnOrAfter = (char*)(*env)->GetStringUTFChars(env, _reauthenticateOnOrAfter, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_build_authn_response_msg(login,
+ _authenticationResult,
+ authenticationMethod,
+ reauthenticateOnOrAfter);
+
+ (*env)->ReleaseStringUTFChars(env, _authenticationMethod, authenticationMethod);
+ (*env)->ReleaseStringUTFChars(env, _reauthenticateOnOrAfter, reauthenticateOnOrAfter);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_buildRequestMsg
+(JNIEnv * env, jobject this){
+ int result;
+ LassoLogin* login;
+
+ login = getCObject(env, this);
+ result = lasso_login_build_request_msg(login);
+
+ return result;}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoLogin_dump
+(JNIEnv * env, jobject this){
+ char* result;
+ LassoLogin* login;
+
+ login = getCObject(env, this);
+ result = lasso_login_dump(login);
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_initAuthnRequest
+(JNIEnv * env, jobject this, jstring _providerID){
+ int result;
+ LassoLogin* login;
+ char *providerID;
+
+ providerID = (char*)(*env)->GetStringUTFChars(env, _providerID, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_init_authn_request(login,
+ providerID);
+
+ (*env)->ReleaseStringUTFChars(env, _providerID, providerID);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_initFromAuthnRequestMsg
+(JNIEnv * env, jobject this, jstring _authnRequestMsg,
+ jint _authnRequestMethod){
+ int result;
+ LassoLogin* login;
+ char *authnRequestMsg;
+
+ authnRequestMsg = (char*)(*env)->GetStringUTFChars(env, _authnRequestMsg, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_init_from_authn_request_msg(login,
+ authnRequestMsg,
+ _authnRequestMethod);
+
+ (*env)->ReleaseStringUTFChars(env, _authnRequestMsg, authnRequestMsg);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_initRequest
+(JNIEnv * env, jobject this, jstring _responseMsg,
+ jint _responseMethod){
+ int result;
+ LassoLogin* login;
+ char *responseMsg;
+
+ responseMsg = (char*)(*env)->GetStringUTFChars(env, _responseMsg, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_init_request(login,
+ responseMsg,
+ _responseMethod);
+
+ (*env)->ReleaseStringUTFChars(env, _responseMsg, responseMsg);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_mustAuthenticate
+(JNIEnv * env, jobject this){
+ int result;
+ LassoLogin* login;
+
+ login = getCObject(env, this);
+ result = lasso_login_must_authenticate(login);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_processAuthnResponseMsg
+(JNIEnv * env, jobject this, jstring _authnResponseMsg){
+ int result;
+ LassoLogin* login;
+ char *authnResponseMsg;
+
+ authnResponseMsg = (char*)(*env)->GetStringUTFChars(env, _authnResponseMsg, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_process_authn_response_msg(login,
+ authnResponseMsg);
+
+ (*env)->ReleaseStringUTFChars(env, _authnResponseMsg, authnResponseMsg);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_processRequestMsg
+(JNIEnv * env, jobject this, jstring _requestMsg){
+ int result;
+ LassoLogin* login;
+ char *requestMsg;
+
+ requestMsg = (char*)(*env)->GetStringUTFChars(env, _requestMsg, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_process_request_msg(login,
+ requestMsg);
+
+ (*env)->ReleaseStringUTFChars(env, _requestMsg, requestMsg);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_processResponseMsg
+(JNIEnv * env, jobject this, jstring _responseMsg){
+ int result;
+ LassoLogin* login;
+ char *responseMsg;
+
+ responseMsg = (char*)(*env)->GetStringUTFChars(env, _responseMsg, NULL);
+
+ login = getCObject(env, this);
+ result = lasso_login_process_response_msg(login,
+ responseMsg);
+
+ (*env)->ReleaseStringUTFChars(env, _responseMsg, responseMsg);
+
+ return result;
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoLogout.c b/java/src/c/com_entrouvert_lasso_LassoLogout.c
new file mode 100644
index 00000000..5d899eac
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoLogout.c
@@ -0,0 +1,126 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdio.h>
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoLogout.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoLogout_init
+(JNIEnv * env, jobject this, jobject _server,
+ jobject _user,
+ jint _providerType){
+ LassoLogout *logout;
+ LassoServer* server;
+ LassoUser* user;
+
+ server = (LassoServer*)getCObject(env, _server);
+ user = (LassoUser*)getCObject(env, _user);
+
+ logout = lasso_logout_new(server, user, _providerType);
+
+ storeCObject(env, this, logout);
+}
+
+
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_buildRequestMsg
+(JNIEnv * env, jobject this){
+ int result;
+ LassoLogout* logout;
+
+ logout = getCObject(env, this);
+ result = lasso_logout_build_request_msg(logout);
+
+ return result;
+}
+
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_buildResponseMmsg
+(JNIEnv * env, jobject this){
+ int result;
+ LassoLogout* logout;
+
+ logout = getCObject(env, this);
+ result = lasso_logout_build_response_msg(logout);
+
+ return result;
+}
+
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_initRequest
+(JNIEnv * env, jobject this, jstring _providerID){
+ int result;
+ LassoLogout* logout;
+ char *providerID;
+
+ providerID = (char*)(*env)->GetStringUTFChars(env, _providerID, NULL);
+
+ logout = getCObject(env, this);
+ result = lasso_logout_init_request(logout, providerID);
+
+ (*env)->ReleaseStringUTFChars(env, _providerID, providerID);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_processRequestMsg
+(JNIEnv * env, jobject this, jstring _requestMsg,
+ jint _requestMethod){
+ int result;
+ LassoLogout* logout;
+ char *requestMsg;
+
+ requestMsg = (char*)(*env)->GetStringUTFChars(env, _requestMsg, NULL);
+
+ logout = getCObject(env, this);
+ result = lasso_logout_process_request_msg(logout,
+ requestMsg,
+ _requestMethod);
+
+ (*env)->ReleaseStringUTFChars(env, _requestMsg, requestMsg);
+
+ return result;
+}
+
+JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_processResponseMsg
+(JNIEnv * env, jobject this, jstring _responseMsg,
+ jint _responseMethod){
+ int result;
+ LassoLogout* logout;
+ char *responseMsg;
+
+ responseMsg = (char*)(*env)->GetStringUTFChars(env, _responseMsg, NULL);
+
+ logout = getCObject(env, this);
+ result = lasso_logout_process_response_msg(logout,
+ responseMsg,
+ _responseMethod);
+
+ (*env)->ReleaseStringUTFChars(env, _responseMsg, responseMsg);
+
+ return result;
+}
+
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoNode.c b/java/src/c/com_entrouvert_lasso_LassoNode.c
new file mode 100644
index 00000000..2d965736
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoNode.c
@@ -0,0 +1,36 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <lasso/lasso.h>
+#include <com_entrouvert_lasso_LassoNode.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoNode_destroy
+(JNIEnv * env, jobject this){
+
+ void* ref = getCObject(env, this);
+
+ lasso_node_destroy(ref);
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoProfileContext.c b/java/src/c/com_entrouvert_lasso_LassoProfileContext.c
new file mode 100644
index 00000000..0f66df9d
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoProfileContext.c
@@ -0,0 +1,148 @@
+/* $Id$
+*
+* JLasso -- Java bindings for Lasso library
+*
+* Copyright (C) 2004 Entr'ouvert
+* http://lasso.labs.libre-entreprise.org
+*
+* Authors: Benjamin Poussin <poussin@codelutin.com>
+*
+* This program is free software{} you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation{} either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY{} without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program{} if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <helper.h>
+#include <lasso/lasso.h>
+#include <com_entrouvert_lasso_LassoProfileContext.h>
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfileContext_getProviderID
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * result;
+
+ profileContext = getCObject(env, this);
+
+ result = profileContext->remote_providerID;
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfileContext_getMsgUrl
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * result;
+
+ profileContext = getCObject(env, this);
+
+ result = profileContext->msg_url;
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfileContext_getMsgBody
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * result;
+
+ profileContext = getCObject(env, this);
+
+ result = profileContext->msg_body;
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfileContext_getMsgRelayState
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * result;
+
+ profileContext = getCObject(env, this);
+
+ result = profileContext->msg_relayState;
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfileContext_initServerField
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * fieldName = "server";
+ char * fieldType = "Lcom/entrouvert/lasso/LassoServer;";
+ char * javaObjectClassName = "com/entrouvert/lasso/LassoServer";
+ LassoServer *cObject;
+
+ profileContext = getCObject(env, this);
+ cObject = profileContext->server;
+
+ checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, cObject);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfileContext_initUserField
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * fieldName = "user";
+ char * fieldType = "Lcom/entrouvert/lasso/LassoUser;";
+ char * javaObjectClassName = "com/entrouvert/lasso/LassoUser";
+ LassoUser *cObject;
+
+ profileContext = getCObject(env, this);
+ cObject = profileContext->user;
+
+ checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, cObject);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfileContext_initRequestField
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * fieldName = "request";
+ char * fieldType = "Lcom/entrouvert/lasso/LassoNode;";
+ char * javaObjectClassName = "com/entrouvert/lasso/LassoNode";
+ LassoNode *cObject;
+
+ profileContext = getCObject(env, this);
+ cObject = profileContext->request;
+
+ if(profileContext->request_type == lassoMessageTypeAuthnRequest){
+ javaObjectClassName = "com/entrouvert/lasso/LassoAuthnRequest";
+ }else if(profileContext->request_type == lassoMessageTypeRequest){
+ javaObjectClassName = "com/entrouvert/lasso/LassoRequest";
+ }else{
+ // Throw error
+ }
+
+ checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, cObject);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfileContext_initResponseField
+(JNIEnv * env, jobject this){
+ LassoProfileContext * profileContext;
+ char * fieldName = "response";
+ char * fieldType = "Lcom/entrouvert/lasso/LassoNode;";
+ char * javaObjectClassName = "com/entrouvert/lasso/LassoNode";
+ LassoNode *cObject;
+
+ profileContext = getCObject(env, this);
+ cObject = profileContext->response;
+
+ if(profileContext->response_type == lassoMessageTypeAuthnResponse){
+ javaObjectClassName = "com/entrouvert/lasso/LassoAuthnResponse";
+ }else if(profileContext->response_type == lassoMessageTypeResponse){
+ javaObjectClassName = "com/entrouvert/lasso/LassoResponse";
+ }else{
+ // Throw error
+ }
+
+ checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, cObject);
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoProvider.c b/java/src/c/com_entrouvert_lasso_LassoProvider.c
new file mode 100644
index 00000000..b089e09f
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoProvider.c
@@ -0,0 +1,66 @@
+/* $Id$
+*
+* JLasso -- Java bindings for Lasso library
+*
+* Copyright (C) 2004 Entr'ouvert
+* http://lasso.labs.libre-entreprise.org
+*
+* Authors: Benjamin Poussin <poussin@codelutin.com>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <helper.h>
+#include <lasso/lasso.h>
+#include <com_entrouvert_lasso_LassoProvider.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProvider_initMetadataField
+(JNIEnv * env, jobject this){
+ LassoProvider * provider;
+ char * fieldName = "metadata";
+ char * fieldType = "Lcom/entrouvert/lasso/LassoNode;";
+ char * javaObjectClassName = "com/entrouvert/lasso/LassoNode";
+ LassoNode *cObject;
+
+ provider = getCObject(env, this);
+ cObject = provider->metadata;
+
+ checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, cObject);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProvider_getPublicKeyField
+(JNIEnv * env, jobject this){
+ LassoProvider * provider;
+ char * result;
+
+ provider = getCObject(env, this);
+
+ result = provider->public_key;
+
+ return (*env)->NewStringUTF(env, result);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProvider_getCertificateField
+(JNIEnv * env, jobject this){
+ LassoProvider * provider;
+ char * result;
+
+ provider = getCObject(env, this);
+
+ result = provider->ca_certificate;
+
+ return (*env)->NewStringUTF(env, result);
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoRequest.c b/java/src/c/com_entrouvert_lasso_LassoRequest.c
new file mode 100644
index 00000000..74790be5
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoRequest.c
@@ -0,0 +1,42 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoRequest.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoRequest_init
+(JNIEnv * env, jobject this, jstring _assertionArtifact){
+ LassoNode *request;
+ char *assertionArtifact;
+
+ assertionArtifact = (char*)(*env)->GetStringUTFChars(env, _assertionArtifact, NULL);
+
+ request = lasso_request_new(assertionArtifact);
+
+ (*env)->ReleaseStringUTFChars(env, _assertionArtifact, assertionArtifact);
+
+ storeCObject(env, this, request);
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoResponse.c b/java/src/c/com_entrouvert_lasso_LassoResponse.c
new file mode 100644
index 00000000..ad294c2a
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoResponse.c
@@ -0,0 +1,36 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoResponse.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoResponse_init
+(JNIEnv * env, jobject this){
+ LassoNode * response;
+
+ response = lasso_response_new();
+
+ storeCObject(env, this, response);
+}
diff --git a/java/src/c/com_entrouvert_lasso_LassoServer.c b/java/src/c/com_entrouvert_lasso_LassoServer.c
new file mode 100644
index 00000000..ac4072f6
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoServer.c
@@ -0,0 +1,104 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoServer.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoServer_init
+(JNIEnv * env, jobject this, jstring _metadata,
+ jstring _publicKey,
+ jstring _privateKey,
+ jstring _certificate,
+ jint _signatureMethod){
+
+ LassoServer *server;
+ char *metadata;
+ char *publicKey;
+ char *privateKey;
+ char *certificate;
+
+ metadata = (char*)(*env)->GetStringUTFChars(env, _metadata, NULL);
+ publicKey = (char*)(*env)->GetStringUTFChars(env, _publicKey, NULL);
+ privateKey = (char*)(*env)->GetStringUTFChars(env, _privateKey, NULL);
+ certificate = (char*)(*env)->GetStringUTFChars(env, _certificate, NULL);
+
+ server = lasso_server_new(metadata, publicKey, privateKey,
+ certificate, _signatureMethod);
+
+ (*env)->ReleaseStringUTFChars(env, _metadata, metadata);
+ (*env)->ReleaseStringUTFChars(env, _publicKey, publicKey);
+ (*env)->ReleaseStringUTFChars(env, _privateKey, privateKey);
+ (*env)->ReleaseStringUTFChars(env, _certificate, certificate);
+
+ storeCObject(env, this, server);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoServer_initFromDump
+(JNIEnv * env, jobject this, jstring _dump){
+ LassoServer *server;
+ char *dump;
+
+ dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
+ server = lasso_server_new_from_dump(dump);
+
+ (*env)->ReleaseStringUTFChars(env, _dump, dump);
+
+ storeCObject(env, this, server);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoServer_addProvider
+(JNIEnv * env, jobject this, jstring _metadata,
+ jstring _publicKey,
+ jstring _certificate){
+ LassoServer *server;
+ char *metadata;
+ char *publicKey;
+ char *certificate;
+
+ metadata = (char*)(*env)->GetStringUTFChars(env, _metadata, NULL);
+ publicKey = (char*)(*env)->GetStringUTFChars(env, _publicKey, NULL);
+ certificate = (char*)(*env)->GetStringUTFChars(env, _certificate, NULL);
+
+ server = (LassoServer*)getCObject(env, this);
+
+ lasso_server_add_provider(server,
+ metadata, publicKey, certificate);
+
+ (*env)->ReleaseStringUTFChars(env, _metadata, metadata);
+ (*env)->ReleaseStringUTFChars(env, _publicKey, publicKey);
+ (*env)->ReleaseStringUTFChars(env, _certificate, certificate);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoServer_dump
+(JNIEnv * env, jobject this){
+ LassoServer *server;
+ char* result;
+
+ server = (LassoServer*)getCObject(env, this);
+ result = lasso_server_dump(server);
+
+ return (*env)->NewStringUTF(env, result);
+}
+
diff --git a/java/src/c/com_entrouvert_lasso_LassoUser.c b/java/src/c/com_entrouvert_lasso_LassoUser.c
new file mode 100644
index 00000000..5897e3d5
--- /dev/null
+++ b/java/src/c/com_entrouvert_lasso_LassoUser.c
@@ -0,0 +1,61 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+#include <com_entrouvert_lasso_LassoUser.h>
+#include <lasso/lasso.h>
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoUser_init
+(JNIEnv * env, jobject this){
+ LassoUser *user;
+
+ user = lasso_user_new();
+
+ storeCObject(env, this, user);
+}
+
+JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoUser_initFromDump
+(JNIEnv * env, jobject this, jstring _dump){
+ LassoUser *user;
+ char *dump;
+
+ dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
+ user = lasso_user_new_from_dump(dump);
+
+ (*env)->ReleaseStringUTFChars(env, _dump, dump);
+
+ storeCObject(env, this, user);
+}
+
+JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoUser_dump
+(JNIEnv * env, jobject this){
+ LassoUser *user;
+ char* result;
+
+ user = (LassoUser*)getCObject(env, this);
+ result = lasso_user_dump(user);
+
+ return (*env)->NewStringUTF(env, result);
+}
+
diff --git a/java/src/c/helper.c b/java/src/c/helper.c
new file mode 100644
index 00000000..b1e5c8f3
--- /dev/null
+++ b/java/src/c/helper.c
@@ -0,0 +1,126 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <helper.h>
+
+void * getObjectRef(JNIEnv * env, jobject this, const char * name){
+ jclass clazz;
+ jfieldID fid;
+ jlong result;
+
+ clazz = (*env)->GetObjectClass(env, this);
+ fid = (*env)->GetFieldID(env, clazz, name, "J");
+
+ result = (*env)->GetLongField(env, this, fid);
+ return (void*)(long)result;
+}
+
+void setObjectRef(JNIEnv * env, jobject this, const char * name, void * objectRef){
+ jclass clazz;
+ jfieldID fid;
+ jlong ref;
+
+ clazz = (*env)->GetObjectClass(env, this);
+ fid = (*env)->GetFieldID(env, clazz, name, "J");
+
+ ref = (jlong)(long)objectRef;
+ (*env)->SetLongField(env, this, fid, ref);
+}
+
+
+void storeCObject(JNIEnv * env, jobject this, void * cobject){
+ setObjectRef(env, this, "c_lasso_object", cobject);
+}
+
+void* getCObject(JNIEnv * env, jobject this){
+ return getObjectRef(env, this, "c_lasso_object");
+}
+
+
+jobject getJavaObjectField(JNIEnv * env, jobject this, const char * fieldName, const char * fieldType){
+ jclass clazz;
+ jfieldID fid;
+ jobject result;
+
+ clazz = (*env)->GetObjectClass(env, this);
+ fid = (*env)->GetFieldID(env, clazz, fieldName, fieldType);
+
+ result = (*env)->GetObjectField(env, this, fid);
+ return result;
+}
+
+void setJavaObjectField(JNIEnv * env, jobject this, const char * fieldName, const char * fieldType, jobject value){
+ jclass clazz;
+ jfieldID fid;
+
+ clazz = (*env)->GetObjectClass(env, this);
+ fid = (*env)->GetFieldID(env, clazz, fieldName, fieldType);
+
+ (*env)->SetObjectField(env, this, fid, value);
+}
+
+jobject instanciate(JNIEnv * env, const char * className){
+ jclass clazz;
+ jmethodID constructor;
+ jobject result;
+
+ clazz = (*env)->FindClass(env, className);
+ if (clazz == NULL) {
+ return NULL; /* exception thrown */
+ }
+ constructor = (*env)->GetMethodID(env, clazz, "<init>", "()V");
+ if (constructor == NULL) {
+ return NULL; /* exception thrown */
+ }
+
+ result = (*env)->NewObject(env, clazz, constructor);
+ (*env)->DeleteLocalRef(env, clazz);
+
+ return result;
+}
+
+int isSameObject(JNIEnv * env, jobject javaObject, void* cObject){
+ return javaObject != NULL && cObject == getCObject(env, javaObject);
+}
+
+void checkAndSetField(JNIEnv * env, jobject this, char * fieldName,
+char * fieldType, char * javaObjectClassName, void * cObject){
+ jobject javaObject;
+
+ // check if change are made
+ javaObject = getJavaObjectField(env, this, fieldName, fieldType);
+ if(isSameObject(env, javaObject, cObject)){
+ // no change made, do nothing
+ return;
+ }
+
+ javaObject = instanciate(env, javaObjectClassName);
+ if(javaObject == NULL){
+ return; /* exception thrown */
+ }
+
+ // associate C object with JavaObject
+ storeCObject(env, javaObject, cObject);
+ setJavaObjectField(env, this, fieldName, fieldType, javaObject);
+}
diff --git a/java/src/c/helper.h b/java/src/c/helper.h
new file mode 100644
index 00000000..ba8304eb
--- /dev/null
+++ b/java/src/c/helper.h
@@ -0,0 +1,81 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _HELPER_H_
+#define _HELPER_H_
+
+#include <jni.h>
+
+/**
+* Store C object in Java object
+*/
+void storeCObject(JNIEnv * env, jobject this, void * cobject);
+
+/**
+* Get C object from Java object
+*/
+void* getCObject(JNIEnv * env, jobject this);
+
+/**
+* Get pointer object stored in java field
+* @param name name of field used to store pointer
+* @return object pointer
+*/
+void * getObjectRef(JNIEnv * env, jobject this, const char * name);
+
+/**
+* Store object pointer in java field
+* @param name name of field used to store pointer
+* @param objectRef pointer to store
+*/
+void setObjectRef(JNIEnv * env, jobject this, const char * name, void * objectRef);
+
+/**
+* Get value of attribute, attribute must be Java object
+*/
+jobject getJavaObjectField(JNIEnv * env, jobject this, const char * fieldName, const char * fieldType);
+
+/**
+* Store new value for Java object attribute, attribute must be Java object
+*/
+void setJavaObjectField(JNIEnv * env, jobject this, const char * name, const char * fieldType, jobject value);
+
+/**
+* Instanciate a new object. Default constructor used
+*/
+jobject instanciate(JNIEnv * env, const char * className);
+
+/**
+* Check if Java object store the C object passed in parameter
+*/
+int isSameObject(JNIEnv * env, jobject javaObject, void* cObject);
+
+/**
+* If field in Java object don't represent C object, then create new Java
+* object representation for this C object and set java field.
+*/
+void checkAndSetField(JNIEnv * env, jobject this, char * fieldName,
+char * fieldType, char * javaObjectClassName, void * cObject);
+
+#endif
diff --git a/java/src/java/com/entrouvert/lasso/Lasso.java b/java/src/java/com/entrouvert/lasso/Lasso.java
new file mode 100644
index 00000000..96c765db
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/Lasso.java
@@ -0,0 +1,50 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/* *
+ * Lasso.java
+ *
+ * Created: 17 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class Lasso { // Lasso
+
+ static {
+ System.loadLibrary("jlasso");
+ }
+
+ native static public int init();
+ native static public int shutdown();
+
+} // Lasso
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoAuthnRequest.java b/java/src/java/com/entrouvert/lasso/LassoAuthnRequest.java
new file mode 100644
index 00000000..6fbf0e6f
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoAuthnRequest.java
@@ -0,0 +1,64 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoRequest.java
+ *
+ * Created: 17 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoAuthnRequest extends LassoNode { // LassoAuthnRequest
+
+ public LassoAuthnRequest(String providerID){
+ init(providerID);
+ }
+
+ native protected void init(String providerID);
+
+ // From LassoLibAuthnRequest
+
+ native public void setAffiliationID(String affiliationId);
+ native public void setassertionConsumerServiceID(String assertionConsumerServiceID);
+ native public void setContent(String content);
+ native public void setForceAuthn(boolean val);
+ native public void setPassive(boolean val);
+ native public void setNameIdPolicy(String val);
+ native public void setProtocolProfile(String val);
+ native public void setproviderID(String val);
+ native public void setRelayState(String val);
+
+ // not implemented
+ // lasso_lib_authn_request_set_requestAuthnContext(LassoLibRequestAuthnContext*)
+ // lasso_lib_authn_request_set_scoping(LassoLibScoping*)
+
+} // LassoAuthnRequest
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoAuthnResponse.java b/java/src/java/com/entrouvert/lasso/LassoAuthnResponse.java
new file mode 100644
index 00000000..f890521b
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoAuthnResponse.java
@@ -0,0 +1,53 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/* *
+ * LassoAuthnResponse.java
+ *
+ * Created: 19 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoAuthnResponse { // LassoAuthnResponse
+
+ public LassoAuthnResponse(String providerID, LassoNode request){
+ init(providerID, request);
+ }
+
+ native protected void init(String providerID, LassoNode request);
+ native public String getStatus();
+
+ // From LassoSamlpResponse
+
+ native public void setContent(String val);
+ native public void setProviderID(String val);
+ native public void setRelayState(String val);
+} // LassoAuthnResponse
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoLogin.java b/java/src/java/com/entrouvert/lasso/LassoLogin.java
new file mode 100644
index 00000000..881007cd
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoLogin.java
@@ -0,0 +1,91 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoLogin.java
+ *
+ * Created: 16 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoLogin extends LassoProfileContext { // LassoLogin
+
+ public LassoLogin(LassoServer server, LassoUser user){
+ this.server = server;
+ this.user = user;
+ init(server, user);
+ }
+
+ public LassoLogin(LassoServer server, LassoUser user, String dump){
+ this.server = server;
+ this.user = user;
+ initFromDump(server, user, dump);
+ }
+
+ native protected void init(LassoServer server, LassoUser user);
+
+ native protected void initFromDump(LassoServer server,
+ LassoUser user,
+ String dump);
+
+ native public int buildArtifactMsg(int authenticationResult,
+ String authenticationMethod,
+ String reauthenticateOnOrAfter,
+ int method);
+
+ native public int buildAuthnRequestMsg();
+
+ native public int buildAuthnResponseMsg(int authenticationResult,
+ String authenticationMethod,
+ String reauthenticateOnOrAfter);
+
+ native public int buildRequestMsg();
+
+ native public String dump();
+
+ native public int initAuthnRequest(String providerId);
+
+ native public int initFromAuthnRequestMsg(String authnRequestMsg,
+ int authnRequestMethod);
+
+ native public int initRequest(String responseMsg,
+ int responseMethod);
+
+ native public int mustAuthenticate();
+
+ native public int processAuthnResponseMsg(String authnResponseMsg);
+
+ native public int processRequestMsg(String requestMsg);
+
+ native public int processResponseMsg(String responseMsg);
+
+} // LassoLogin
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoLogout.java b/java/src/java/com/entrouvert/lasso/LassoLogout.java
new file mode 100644
index 00000000..3d9bd44c
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoLogout.java
@@ -0,0 +1,60 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoLogout.java
+ *
+ * Created: 16 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoLogout extends LassoProfileContext { // LassoLogout
+
+ public LassoLogout(LassoServer server, LassoUser user, int providerType){
+ this.server = server;
+ this.user = user;
+ init(server, user, providerType);
+ }
+
+ native protected void init(LassoServer server, LassoUser user, int providerType);
+
+ native public int buildRequestMsg();
+
+ native public int buildResponseMsg();
+
+ native public int initRequest(String providerId);
+
+ native public int processRequestMsg(String requestMsg, int requestMethod);
+
+ native public int processResponseMsg(String responseMsg, int responseMethod);
+
+} // LassoLogout
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoNode.java b/java/src/java/com/entrouvert/lasso/LassoNode.java
new file mode 100644
index 00000000..29780d0f
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoNode.java
@@ -0,0 +1,51 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoNode.java
+ *
+ * Created: 17 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public abstract class LassoNode { // LassoNode
+
+ /** used to store ref to the c real object, this field must be used only by native methode */
+ protected long c_lasso_object = 0;
+
+ protected void finalize(){
+ destroy();
+ }
+ native protected void destroy();
+
+
+} // LassoNode
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoProfileContext.java b/java/src/java/com/entrouvert/lasso/LassoProfileContext.java
new file mode 100644
index 00000000..d1f21a9b
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoProfileContext.java
@@ -0,0 +1,77 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoProfileContext.java
+ *
+ * Created: 18 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public abstract class LassoProfileContext extends LassoNode { // LassoProfileContext
+
+ protected LassoServer server = null;
+ protected LassoUser user = null;
+ protected LassoNode request = null;
+ protected LassoNode response = null;
+
+ public LassoServer getServer(){
+ initServerField();
+ return server;
+ }
+
+ public LassoUser getUser(){
+ initUserField();
+ return user;
+ }
+
+ public LassoNode getRequest(){
+ initRequestField();
+ return request;
+ }
+ public LassoNode getResponse(){
+ initResponseField();
+ return response;
+ }
+
+ native public String getProviderID();
+
+ native public String getMsgUrl();
+ native public String getMsgBody();
+ native public String getMsgRelayState();
+
+ native protected void initServerField();
+ native protected void initUserField();
+ native protected void initRequestField();
+ native protected void initResponseField();
+
+} // LassoProfileContext
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoProvider.java b/java/src/java/com/entrouvert/lasso/LassoProvider.java
new file mode 100644
index 00000000..a95165f4
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoProvider.java
@@ -0,0 +1,55 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoProvider.java
+ *
+ * Created: 18 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoProvider extends LassoNode { // LassoProvider
+
+ protected LassoNode metadata = null;
+
+ public LassoNode getMetadata(){
+ if(metadata == null){
+ initMetadataField();
+ }
+ return metadata;
+ }
+
+ native protected void initMetadataField();
+ native protected String getPublicKeyField();
+ native protected String getCertificateField();
+
+} // LassoProvider
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoRequest.java b/java/src/java/com/entrouvert/lasso/LassoRequest.java
new file mode 100644
index 00000000..5044b572
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoRequest.java
@@ -0,0 +1,48 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoRequest.java
+ *
+ * Created: 17 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoRequest extends LassoNode { // LassoRequest
+
+ public LassoRequest(String assertionArtifact){
+ init(assertionArtifact);
+ }
+
+ native protected void init(String assertionArtifact);
+
+} // LassoRequest
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoResponse.java b/java/src/java/com/entrouvert/lasso/LassoResponse.java
new file mode 100644
index 00000000..ff7c0b61
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoResponse.java
@@ -0,0 +1,48 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoResponse.java
+ *
+ * Created: 17 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoResponse extends LassoNode { // LassoResponse
+
+ public LassoResponse(){
+ init();
+ }
+
+ native public void init();
+
+} // LassoResponse
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoServer.java b/java/src/java/com/entrouvert/lasso/LassoServer.java
new file mode 100644
index 00000000..44d34420
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoServer.java
@@ -0,0 +1,77 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoServer.java
+ *
+ * Created: 16 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoServer extends LassoProvider { // LassoServer
+
+ public LassoServer(String metadataFilePath,
+ String publicKeyFilePath,
+ String privateKeyFilePath,
+ String certificateFilePath,
+ int lassoSignatureMethodRsaSha1){
+ init(metadataFilePath, publicKeyFilePath, privateKeyFilePath,
+ certificateFilePath, lassoSignatureMethodRsaSha1);
+ }
+
+ public LassoServer(String dump){
+ initFromDump(dump);
+ }
+
+ /**
+ * This method must set the c_lasso_object. If creation of LassoServer failed
+ * then c_lasso_object's value is 0.
+ */
+ native protected void init(String metadataFilePath,
+ String publicKeyFilePath,
+ String privateKeyFilePath,
+ String certificateFilePath,
+ int lassoSignatureMethodRsaSha1);
+
+ /**
+ * This method must set the c_lasso_object. If creation of LassoServer failed
+ * then c_lasso_object's value is 0.
+ */
+ native protected void initFromDump(String dump);
+
+ native public void addProvider(String idpMetadataFilePath,
+ String idpPublicKeyFilePath,
+ String idpCaCertificateFilePath);
+
+ native public String dump();
+
+} // LassoServer
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoTest.java b/java/src/java/com/entrouvert/lasso/LassoTest.java
new file mode 100644
index 00000000..422fa228
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoTest.java
@@ -0,0 +1,53 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+/* *
+ * LassoTest.java
+ *
+ * Created: 16 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoTest { // LassoTest
+
+ static public void main(String [] args){
+ System.out.println(System.mapLibraryName("jlasso"));
+ System.loadLibrary("jlasso");
+ LassoServer ls = new LassoServer("", "", "", "", 0);
+ ls = new LassoServer("");
+ System.gc();
+ ls.addProvider("","","");
+ System.out.println(ls.dump());
+ }
+
+} // LassoTest
+
diff --git a/java/src/java/com/entrouvert/lasso/LassoUser.java b/java/src/java/com/entrouvert/lasso/LassoUser.java
new file mode 100644
index 00000000..5654f165
--- /dev/null
+++ b/java/src/java/com/entrouvert/lasso/LassoUser.java
@@ -0,0 +1,56 @@
+/* $Id$
+ *
+ * JLasso -- Java bindings for Lasso library
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.labs.libre-entreprise.org
+ *
+ * Authors: Benjamin Poussin <poussin@codelutin.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* *
+ * LassoUser.java
+ *
+ * Created: 17 juil. 2004
+ *
+ * @author Benjamin Poussin <poussin@codelutin.com>
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+
+package com.entrouvert.lasso;
+
+public class LassoUser extends LassoNode { // LassoUser
+
+ public LassoUser(){
+ init();
+ }
+
+ public LassoUser(String dump){
+ initFromDump(dump);
+ }
+
+ native protected void init();
+
+ native protected void initFromDump(String dump);
+
+ native public String dump();
+
+} // LassoUser
+