- Added java binding swig generation.

- Added Swig Interface file.

- Added readme for java build dependencies

- Removed old java/src directory (still present on the CVS and this is
  important).
This commit is contained in:
Romain Chantereay 2004-08-10 11:18:17 +00:00
parent c753e696c4
commit 94033fe5d9
40 changed files with 3341 additions and 2563 deletions

2
README.JAVA Normal file
View File

@ -0,0 +1,2 @@
If you want to use gcc to compile java binding, jlasso compilation depends on
the development files of libgcj (libgcj4-dev package).

View File

@ -116,6 +116,7 @@ dnl Check for programs
dnl
AC_PROG_CC
LT_AC_PROG_RC
AM_PROG_GCJ
AC_EXEEXT
AC_PROG_CC_C_O
AM_SANITY_CHECK
@ -390,7 +391,7 @@ if test "z$PKG_CONFIG_PATH" != "z"; then
export PKG_CONFIG_PATH
fi
PKG_CHECK_MODULES(LASSO, glib-2.0 gobject-2.0 libxml-2.0 libxslt xmlsec1 xmlsec1-openssl)
PKG_CHECK_MODULES(LASSO, glib-2.0 gobject-2.0 libxml-2.0 libxslt xmlsec1 xmlsec1-openssl openssl)
dnl Let people disable the gtk-doc stuff.
AC_ARG_ENABLE(gtk-doc, [ --disable-gtk-doc Disable documentation build],,
@ -528,9 +529,9 @@ php/tests/Makefile
tests/Makefile
java/Makefile]
dnl [java/coldfusion/Makefile]
[java/src/Makefile
java/src/java/Makefile
java/src/c/Makefile]
dnl [java/src/Makefile
dnl java/src/java/Makefile
dnl java/src/c/Makefile]
[lasso.pc:lasso.pc.in]
dnl [lasso-config:lasso-config.in]
dnl [lasso.spec:lasso.spec.in]

View File

@ -1,62 +1,92 @@
NULL =
TARGET=target
#JAVAC=/usr/lib/kaffe/bin/javac
#JAVAH=/usr/lib/kaffe/bin/javah
#JAVAH_CLASSPATH_PREFIX=/usr/share/kaffe/Klasses.jar:
#JAR=/usr/lib/kaffe/bin/jar
NULL=
# Define the java module
JAVA_MODULE=lasso
# Define java package name
JAVA_PACKAGE=com.entrouvert.lasso
# Define java Package directory, the tailing '/' is mandatory.
JAVA_PATH=com/entrouvert/lasso/
CLASSPATH=.
javalibdir=$(prefix)/lib/java
javasharedir=$(prefix)/share/java
# Shared library.
javalib_LTLIBRARIES=libjlasso.la
libjlasso_la_SOURCES=$(JAVA_MODULE)_wrap.c
libjlasso_la_CFLAGS=$(JDK_INCLUDES) $(LASSO_CFLAGS)
libjlasso_la_LIBADD=$(top_srcdir)/lasso/liblasso.la \
$(LASSO_LIBS) \
$(NULL)
libjlasso_la_LDFLAGS=-no-undefined -version-info @LASSO_VERSION_INFO@ \
$(NULL)
# Java package
javashare_DATA=lasso.jar
JAVA_JAR=lasso.jar
SWIG_OUTPUTS=$(JAVA_PATH)$(JAVA_MODULE).java $(JAVA_MODULE)_wrap.c
JAVA_CRUFT=$(JAVA_PATH)$(JAVA_MODULE).class $(JAVA_MODULE)_wrap.o \
$(JAVA_JAR) \
$(JAVA_PATH)$(JAVA_MODULE)JNI.java
# Sources file in order to beautifully (and so humanly) wrap lasso.
JAVA_SOURCE_FILES=$(NULL)
# Bytecode version of the java source files.
JAVA_CLASS_FILES=$(NULL)
C_SOURCE_DIR=../c
C_SOURCE=${wildcard ${C_SOURCE_DIR}/*.c}
C_BUILD_DIR=${C_SOURCE_DIR}
C_OBJECT=${C_SOURCE:.c=.o}
if MINGW
# JAVA_LDFLAGS=-L/usr/local/lib -lgobject-2.0-0 -lglib-2.0-0 -llasso
LASSO_DLL=${TARGET}/jlasso.dll
else
# JAVA_LDFLAGS=-lgobject-2.0 -lglib-2.0 -llasso
LASSO_SO=${TARGET}/libjlasso.so
endif
SUBDIRS=
# The SWIG outputs are included in the distribution so SWIG is not
# required to use the Java interface
EXTRA_DIST= lasso-fragment.java \
$(SWIG_OUTPUTS)
CLEANFILES=$(JAVA_CRUFT)
MAINTAINERCLEANFILES=$(SWIG_OUTPUTS)
if MINGW
binary-c: ${LASSO_DLL}
else
binary-c: ${LASSO_SO}
endif
$(JAVA_MODULE)_wrap.c $(JAVA_PATH)$(JAVA_MODULE).java.in: $(srcdir)/../swig/Lasso.i
here=`pwd`; \
cd $(JAVA_PATH); \
$(SWIG) -v -java -noproxy -module $(JAVA_MODULE) -package $(JAVA_PACKAGE) -o $(JAVA_MODULE)_wrap.c $$here/$<; \
if test -r $(JAVA_MODULE)JNI.java; then \
echo "Fixing SWIG 1.3.15+ broken Java API"; \
rm -f $(JAVA_MODULE).java SWIGTYPE_*; \
sed -e 's/class $(JAVA_MODULE)JNI/public class $(JAVA_MODULE)/' $(JAVA_MODULE)JNI.java > $(JAVA_MODULE).java; \
sed -e 's/$(JAVA_MODULE)JNI/$(JAVA_MODULE)/g' $(JAVA_MODULE)_wrap.c > $(JAVA_MODULE)_wrap.c.new; \
rm -f $(JAVA_MODULE)_wrap.c $(JAVA_MODULE)JNI.java; \
mv $(JAVA_MODULE)_wrap.c.new $(JAVA_MODULE)_wrap.c; \
fi; \
mv $(JAVA_MODULE)_wrap.c $$here; \
mv $(JAVA_MODULE).java $(JAVA_MODULE).java.in
if MINGW
mylibs = -L../win32/.libs -llasso -L/usr/local/lib
${LASSO_DLL}:
gcc -mno-cygwin -shared -o ${TARGET}/jlasso.dll \
-Wl,--out-implib=${TARGET}/jlasso.a \
-Wl,--add-stdcall-alias \
-Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--whole-archive ${C_OBJECT} \
-Wl,--no-whole-archive -lgobject-2.0-0 -lglib-2.0-0 ${mylibs}
else
mylibs = ../lasso/.libs/liblasso.so
${LASSO_SO}:
$(CC) -shared -lgobject-2.0 -lglib-2.0 $(mylibs) ${C_OBJECT} -o $@
endif
lib_LTLIBRARIES = \
libjlasso.la \
$(NULL)
libjlasso_la_SOURCES = $(NULL)
libjlasso_la_LIBADD = \
binary-c \
$(NULL)
all-redirect: binary-c
clean: clean-recursive
rm -fr ${TARGET} *~ *.log
# FIXME There must be a better way to do this with SWIG
$(JAVA_PATH)$(JAVA_MODULE).java: $(JAVA_PATH)$(JAVA_MODULE).java.in lasso-fragment.java
sed -e 's/^}//' $(JAVA_PATH)$(JAVA_MODULE).java.in > $(JAVA_PATH)$(JAVA_MODULE).java.tmp
cat $(JAVA_PATH)$(JAVA_MODULE).java.tmp lasso-fragment.java > $@
echo "}" >> $@
rm -f $(JAVA_PATH)$(JAVA_MODULE).java.tmp
EXTRA_DIST = $(NULL)
SUBDIRS = src $(NULL)
clean-local:
rm -f *.class
all-local: $(JAVA_JAR)
$(JAVA_PATH)$(JAVA_MODULE).class:
$(JAVAC) $(JAVAC_FLAGS) $(JAVA_PATH)$(JAVA_MODULE).java
$(JAVA_JAR): $(JAVA_PATH)$(JAVA_MODULE).class
rm -f $@
jar cf $@ $(JAVA_PATH)$(JAVA_MODULE).class
.deps/libjlasso_la-lasso_wrap.Plo:
echo "#dummy" > .deps/libjlasso_la-lasso_wrap.Plo
.deps/com/entrouvert/lasso/lasso.Po:
mkdir -p .deps/com/entrouvert/lasso
echo "#dummy" > .deps/com/entrouvert/lasso/lasso.Po

21
java/lasso-fragment.java Normal file
View File

@ -0,0 +1,21 @@
// START lasso-fragment.java
//
// -*- Mode: java; c-basic-offset: 4 -*-
//
// lasso-fragment.java - Inserted Java fragment for generated SWIG code
//
// $Id$
//
static
{
// Load a library whose "core" name is 'jlasso'
// Operating system specific stuff will be added to make from this an
// actual filename: Under Unix this will become libjlasso.so
// while under Windows it will likely become something like
// jlasso.dll
System.loadLibrary("jlasso");
}
// END lasso-fragment.java

View File

@ -1 +0,0 @@
SUBDIRS=java c

View File

@ -1,2 +0,0 @@
com_entrouvert_lasso_*.h
target_classes.h

View File

@ -1,33 +0,0 @@
if MINGW
JAVA_CFLAGS = -mno-cygwin -mwindows -D_MSC_VER=1 \
-D_WIN32 -DWIN32 -DLASSO_DEBUG \
-I$(top_srcdir) \
-I. -g \
-I/usr/local/include \
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include \
-I/usr/local/include/libxml2 \
-DXMLSEC_CRYPTO="openssl" -DXMLSEC_LIBXML_260=1 \
-D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1 \
-DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1
else
JAVA_CFLAGS = \
-g \
-I. -I/opt/jdk/include -I/opt/jdk/include/linux \
-I$(top_srcdir) \
-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\"
endif
C_SOURCE = ${wildcard *.c}
C_OBJECT = ${C_SOURCE:.c=.o}
.PHONY: clean all
all: ${C_OBJECT}
%.o: %.c %.h
${CC} $(JAVA_CFLAGS) -c $<
clean:
rm -f ${C_OBJECT} *~

View File

@ -1,48 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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();
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_Lasso_getRequestTypeFromSoapMsg
(JNIEnv * env, jclass clazz, jstring _value){
int result;
char *value;
value = (char*)(*env)->GetStringUTFChars(env, _value, NULL);
result = lasso_profile_get_request_type_from_soap_msg(value);
(*env)->ReleaseStringUTFChars(env, _value, value);
return result;
}

View File

@ -1,154 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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);
setCObject(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_setConsent
(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);
}

View File

@ -1,94 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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);
setCObject(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);
}

View File

@ -1,61 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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_LassoIdentity.h>
#include <lasso/lasso.h>
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoIdentity_init
(JNIEnv * env, jobject this){
LassoIdentity *identity;
identity = lasso_identity_new();
setCObject(env, this, identity);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoIdentity_initFromDump
(JNIEnv * env, jobject this, jstring _dump){
LassoIdentity *identity;
char *dump;
dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
identity = lasso_identity_new_from_dump(dump);
(*env)->ReleaseStringUTFChars(env, _dump, dump);
setCObject(env, this, identity);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoIdentity_dump
(JNIEnv * env, jobject this){
LassoIdentity *identity;
char* result;
identity = (LassoIdentity*)getCObject(env, this);
result = lasso_identity_dump(identity);
return (*env)->NewStringUTF(env, result);
}

View File

@ -1,298 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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) {
LassoLogin *login;
LassoServer* server;
server = (LassoServer*)getCObject(env, _server);
login = LASSO_LOGIN(lasso_login_new(server));
setCObject(env, this, login);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoLogin_initFromDump
(JNIEnv * env, jobject this, jobject _server, jobject _identity, jstring _dump) {
LassoLogin *login;
LassoServer* server;
char *dump;
LassoIdentity* identity = NULL;
server = (LassoServer*)getCObject(env, _server);
if(_identity != NULL){
identity = (LassoIdentity*)getCObject(env, _identity);
}
dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
login = LASSO_LOGIN(lasso_login_new_from_dump(server, identity, dump));
(*env)->ReleaseStringUTFChars(env, _dump, dump);
setCObject(env, this, login);
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_buildArtifactMsg
(JNIEnv * env, jobject this, jboolean _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 jint JNICALL Java_com_entrouvert_lasso_LassoLogin_acceptSso
(JNIEnv * env, jobject this){
LassoLogin* login;
int result;
login = getCObject(env, this);
result = lasso_login_accept_sso(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 jboolean 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;
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoLogin_getAssertionArtifact
(JNIEnv * env, jobject this) {
LassoLogin * login;
char *result;
login = getCObject(env, this);
result = login->assertionArtifact;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogin_getProtocolProfile
(JNIEnv * env, jobject this) {
LassoLogin * login;
int result;
login = getCObject(env, this);
result = login->protocolProfile;
return result;
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoLogin_getResponseDump
(JNIEnv * env, jobject this) {
LassoLogin * login;
char *result;
login = getCObject(env, this);
result = login->response_dump;
return (*env)->NewStringUTF(env, result);
}

View File

@ -1,131 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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, jint _providerType){
LassoLogout *logout;
LassoServer* server;
server = (LassoServer*)getCObject(env, _server);
logout = lasso_logout_new(server, _providerType);
setCObject(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_buildResponseMsg
(JNIEnv * env, jobject this){
int result;
LassoLogout* logout;
logout = getCObject(env, this);
result = lasso_logout_build_response_msg(logout);
return result;
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoLogout_getNextProviderId
(JNIEnv * env, jobject this){
char* result;
LassoLogout* logout;
logout = getCObject(env, this);
result = lasso_logout_get_next_providerID(logout);
if (! result)
return NULL;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_initRequest
(JNIEnv * env, jobject this, jstring _providerID){
int result;
LassoLogout* logout;
char *providerID = NULL;
if (_providerID)
providerID = (char*)(*env)->GetStringUTFChars(env, _providerID, NULL);
logout = getCObject(env, this);
result = lasso_logout_init_request(logout, providerID);
if (_providerID)
(*env)->ReleaseStringUTFChars(env, _providerID, providerID);
return result;
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_loadRequestMsg
(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_load_request_msg(logout, requestMsg, _requestMethod);
(*env)->ReleaseStringUTFChars(env, _requestMsg, requestMsg);
return result;
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoLogout_processRequest
(JNIEnv * env, jobject this){
LassoLogout* logout;
logout = getCObject(env, this);
return lasso_logout_process_request(logout);
}
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;
}

View File

@ -1,36 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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);
}

View File

@ -1,27 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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>

View File

@ -1,245 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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_LassoProfile.h>
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfile_getCIdentity
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * fieldName = "identity";
char * fieldType = "Lcom/entrouvert/lasso/LassoIdentity;";
char * javaObjectClassName = "com/entrouvert/lasso/LassoIdentity";
LassoIdentity *identity;
profile = getCObject(env, this);
identity = lasso_profile_get_identity(profile);
checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, identity);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfile_getCRequest
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * fieldName = "request";
char * fieldType = "Lcom/entrouvert/lasso/LassoNode;";
char * javaObjectClassName = "com/entrouvert/lasso/LassoNode";
LassoNode *request;
profile = getCObject(env, this);
request = profile->request;
if (profile->request_type == lassoMessageTypeAuthnRequest) {
javaObjectClassName = "com/entrouvert/lasso/LassoAuthnRequest";
} else if (profile->request_type == lassoMessageTypeRequest) {
javaObjectClassName = "com/entrouvert/lasso/LassoRequest";
} else {
/* FIXME: Throw error */
}
checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, request);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfile_getCResponse
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * fieldName = "response";
char * fieldType = "Lcom/entrouvert/lasso/LassoNode;";
char * javaObjectClassName = "com/entrouvert/lasso/LassoNode";
LassoNode *response;
profile = getCObject(env, this);
response = profile->response;
if (profile->response_type == lassoMessageTypeAuthnResponse) {
javaObjectClassName = "com/entrouvert/lasso/LassoAuthnResponse";
} else if (profile->response_type == lassoMessageTypeResponse) {
javaObjectClassName = "com/entrouvert/lasso/LassoResponse";
} else {
/* FIXME: Throw error */
}
checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, response);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfile_getCServer
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * fieldName = "server";
char * fieldType = "Lcom/entrouvert/lasso/LassoServer;";
char * javaObjectClassName = "com/entrouvert/lasso/LassoServer";
LassoServer *server;
profile = getCObject(env, this);
server = profile->server;
checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, server);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoProfile_getCSession
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * fieldName = "session";
char * fieldType = "Lcom/entrouvert/lasso/LassoSession;";
char * javaObjectClassName = "com/entrouvert/lasso/LassoSession";
LassoSession *session;
profile = getCObject(env, this);
session = lasso_profile_get_session(profile);
checkAndSetField(env, this, fieldName, fieldType, javaObjectClassName, session);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfile_getMsgBody
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * result;
profile = getCObject(env, this);
result = profile->msg_body;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfile_getMsgRelayState
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * result;
profile = getCObject(env, this);
result = profile->msg_relayState;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfile_getMsgUrl
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * result;
profile = getCObject(env, this);
result = profile->msg_url;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfile_getNameIdentifier
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char *result;
profile = getCObject(env, this);
result = profile->nameIdentifier;
if (result == NULL)
return NULL;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoProfile_getProviderID
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * result;
profile = getCObject(env, this);
result = profile->remote_providerID;
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoProfile_getRequestType
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * result;
profile = getCObject(env, this);
return profile->request_type;
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoProfile_getResponseType
(JNIEnv *env, jobject this) {
LassoProfile * profile;
char * result;
profile = getCObject(env, this);
return profile->response_type;
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoProfile_setCIdentity
(JNIEnv *env, jobject this) {
char *fieldName = "identity";
char *fieldType = "Lcom/entrouvert/lasso/LassoIdentity;";
jobject _identity;
LassoIdentity *identity;
LassoProfile *profile;
profile = getCObject(env, this);
_identity = getJavaObjectField(env, this, fieldName, fieldType);
identity = getCObject(env, _identity);
return lasso_profile_set_identity(profile, identity);
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoProfile_setCSession
(JNIEnv *env, jobject this) {
char *fieldName = "session";
char *fieldType = "Lcom/entrouvert/lasso/LassoSession;";
jobject _session;
LassoSession *session;
LassoProfile *profile;
profile = getCObject(env, this);
_session = getJavaObjectField(env, this, fieldName, fieldType);
session = getCObject(env, _session);
return lasso_profile_set_session(profile, session);
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoProfile_setIdentityFromDump
(JNIEnv *env, jobject this, jstring _dump) {
int result;
LassoProfile *profile;
char *dump;
profile = getCObject(env, this);
dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
result = lasso_profile_set_identity_from_dump(profile, dump);
(*env)->ReleaseStringUTFChars(env, _dump, dump);
return result;
}
JNIEXPORT jint JNICALL Java_com_entrouvert_lasso_LassoProfile_setSessionFromDump
(JNIEnv *env, jobject this, jstring _dump) {
int result;
LassoProfile *profile;
char *dump;
profile = getCObject(env, this);
dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
result = lasso_profile_set_session_from_dump(profile, dump);
(*env)->ReleaseStringUTFChars(env, _dump, dump);
return result;
}

View File

@ -1,66 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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);
}

View File

@ -1,42 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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);
setCObject(env, this, request);
}

View File

@ -1,36 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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();
setCObject(env, this, response);
}

View File

@ -1,113 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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);
setCObject(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);
setCObject(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);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoServer_destroy
(JNIEnv * env, jobject this){
void* server = (LassoServer*)getCObject(env, this);
lasso_server_destroy(server);
}

View File

@ -1,79 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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_LassoSession.h>
#include <lasso/lasso.h>
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoSession_init
(JNIEnv * env, jobject this){
LassoSession *session;
session = lasso_session_new();
setCObject(env, this, session);
}
JNIEXPORT void JNICALL Java_com_entrouvert_lasso_LassoSession_initFromDump
(JNIEnv * env, jobject this, jstring _dump){
LassoSession *session;
char *dump;
dump = (char*)(*env)->GetStringUTFChars(env, _dump, NULL);
session = lasso_session_new_from_dump(dump);
(*env)->ReleaseStringUTFChars(env, _dump, dump);
setCObject(env, this, session);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoSession_dump
(JNIEnv * env, jobject this){
LassoSession *session;
char* result;
session = (LassoSession*)getCObject(env, this);
result = lasso_session_dump(session);
return (*env)->NewStringUTF(env, result);
}
JNIEXPORT jstring JNICALL Java_com_entrouvert_lasso_LassoSession_getAuthenticationMethod
(JNIEnv * env, jobject this, jstring _remoteProviderId){
char *remoteProviderId = NULL;
char *result;
LassoSession* session;
if (_remoteProviderId)
remoteProviderId = (char*)(*env)->GetStringUTFChars(env, _remoteProviderId, NULL);
session = getCObject(env, this);
result = lasso_session_get_authentication_method(session, remoteProviderId);
if (_remoteProviderId)
(*env)->ReleaseStringUTFChars(env, _remoteProviderId, remoteProviderId);
return (*env)->NewStringUTF(env, result);
}

View File

@ -1,125 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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 checkAndSetField(JNIEnv *env, jobject this, char *fieldName,
char *fieldType, char *javaObjectClassName, void *cObject) {
jobject javaObject;
/* check if changes are made */
javaObject = getJavaObjectField(env, this, fieldName, fieldType);
if(isSameObject(env, javaObject, cObject)){
/* no change made, do nothing */
return;
}
javaObject = instantiate(env, javaObjectClassName);
if(javaObject == NULL){
return; /* exception thrown */
}
/* associate C object with JavaObject */
setCObject(env, javaObject, cObject);
setJavaObjectField(env, this, fieldName, fieldType, javaObject);
}
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 * 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;
}
jobject instantiate(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 setCObject(JNIEnv * env, jobject this, void * cobject) {
setObjectRef(env, this, "c_lasso_object", cobject);
}
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);
}
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);
}

View File

@ -1,83 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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>
/**
* 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);
/**
* Get C object from Java object
*/
void *getCObject(JNIEnv * env, jobject this);
/**
* Get value of attribute, attribute must be Java object
*/
jobject getJavaObjectField(JNIEnv * env, jobject this, const char * fieldName,
const char * fieldType);
/**
* 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);
/**
* Instantiate a new object. Default constructor used
*/
jobject instantiate(JNIEnv * env, const char * className);
/**
* Check if Java object store the C object passed in parameter
*/
int isSameObject(JNIEnv * env, jobject javaObject, void* cObject);
/**
* Store C object in Java object
*/
void setCObject(JNIEnv * env, jobject this, void * cobject);
/**
* 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);
/**
* 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);
#endif

View File

@ -1,19 +0,0 @@
TARGET=../../target
JAVA_BUILD_DIR=${TARGET}/classes
JAVA_PACKAGE=com.entrouvert.lasso
JAVA_SOURCE=${wildcard ${subst .,/,${JAVA_PACKAGE}}/*.java}
LASSO_JAR=${TARGET}/lasso.jar
C_SOURCE_DIR=../c
C_SOURCE=${wildcard ${C_SOURCE_DIR}/*.c}
JAVA_CLASSES=${addprefix ${JAVA_PACKAGE}., ${filter-out LassoTest, ${basename ${notdir ${JAVA_SOURCE}}}}}
binary-java:
mkdir -p ${JAVA_BUILD_DIR}
${JAVAC} ${JAVAC_FLAGS} -d ${JAVA_BUILD_DIR} ${JAVA_SOURCE}
${JAR} cf ${LASSO_JAR} -C ${JAVA_BUILD_DIR} com
generate-header: binary-java
${JAVAH} ${JAVAH_FLAGS} -d ${C_SOURCE_DIR} -classpath ${JAVAH_CLASSPATH_PREFIX}${JAVA_BUILD_DIR} ${JAVA_CLASSES}
all: generate-header

View File

@ -1,95 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class Lasso { // Lasso
static {
System.loadLibrary("jlasso");
}
/* HTTP methods used by Liberty Alliance */
static final public int httpMethodGet = 1;
static final public int httpMethodPost = 2;
static final public int httpMethodRedirect = 3;
static final public int httpMethodSoap = 4;
/* Consent types */
static final public String libConsentObtained = "urn:liberty:consent:obtained";
static final public String libConsentUnavailable = "urn:liberty:consent:unavailable";
static final public String libConsentInapplicable = "urn:liberty:consent:inapplicable";
/* NameIDPolicy types */
static final public String libNameIdPolicyTypeNone = "none";
static final public String libNameIdPolicyTypeOneTime = "onetime";
static final public String libNameIdPolicyTypeFederated = "federated";
static final public String libNameIdPolicyTypeAny = "any";
/* Login ProtocolProfile types */
static final public int loginProtocolProfileBrwsArt = 1;
static final public int loginProtocolProfileBrwsPost = 2;
/* Message types */
static final public int messageTypeNone = 0;
static final public int messageTypeAuthnRequest = 1;
static final public int messageTypeAuthnResponse = 2;
static final public int messageTypeRequest = 3;
static final public int messageTypeResponse = 4;
static final public int messageTypeArtifact = 5;
/* Provider types */
static final public int providerTypeSp = 1;
static final public int providerTypeIdp = 2;
/* Request types */
static final public int requestTypeLogin = 1;
static final public int requestTypeLogout = 2;
static final public int requestTypeFederationTermination = 3;
static final public int requestTypeRegisterNameIdentifier = 4;
static final public int requestTypeNameIdentifierMapping = 5;
/* AuthenticationMethod types */
static final public String samlAuthenticationMethodPassword = "urn:oasis:names:tc:SAML:1.0:am:password";
static final public String samlAuthenticationMethodKerberos = "urn:ietf:rfc:1510";
static final public String samlAuthenticationMethodSecureRemotePassword = "urn:ietf:rfc:2945";
static final public String samlAuthenticationMethodHardwareToken = "urn:oasis:names:tc:SAML:1.0:am:HardwareToken";
static final public String samlAuthenticationMethodSmartcardPki = "urn:ietf:rfc:2246";
static final public String samlAuthenticationMethodSoftwarePki = "urn:oasis:names:tc:SAML:1.0:am:X509-PKI";
static final public String samlAuthenticationMethodPgp = "urn:oasis:names:tc:SAML:1.0:am:PGP";
static final public String samlAuthenticationMethodSPki = "urn:oasis:names:tc:SAML:1.0:am:SPKI";
static final public String samlAuthenticationMethodXkms = "urn:oasis:names:tc:SAML:1.0:am:XKMS";
static final public String samlAuthenticationMethodXmlDSig = "urn:ietf:rfc:3075";
static final public String samlAuthenticationMethodUnspecified = "urn:oasis:names:tc:SAML:1.0:am:unspecified";
/* SignatureMethod types */
static final public int signatureMethodRsaSha1 = 1;
static final public int signatureMethodDsaSha1 = 2;
native static public int init();
native static public int getRequestTypeFromSoapMsg(String soapRequestMsg);
native static public int shutdown();
} // Lasso

View File

@ -1,53 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoAuthnRequest extends LassoNode { // LassoAuthnRequest
private 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 setConsent(String consent);
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

View File

@ -1,43 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoAuthnResponse { // LassoAuthnResponse
private 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

View File

@ -1,44 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoIdentity extends LassoObject { // LassoIdentity
public LassoIdentity(){
init();
}
public LassoIdentity(String dump){
initFromDump(dump);
}
native protected void init();
native protected void initFromDump(String dump);
native public String dump();
} // LassoIdentity

View File

@ -1,86 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoLogin extends LassoProfile { // LassoLogin
public LassoLogin(LassoServer server){
this.server = server;
init(server);
}
public LassoLogin(LassoServer server, LassoIdentity identity, String dump){
this.server = server;
this.identity = identity;
initFromDump(server, identity, dump);
}
native protected void init(LassoServer server);
native protected void initFromDump(LassoServer server,
LassoIdentity identity,
String dump);
native public int acceptSso();
native public int buildArtifactMsg(boolean 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 String getAssertionArtifact();
native public int getProtocolProfile();
native public String getResponseDump();
native public boolean mustAuthenticate();
native public int processAuthnResponseMsg(String authnResponseMsg);
native public int processRequestMsg(String requestMsg);
native public int processResponseMsg(String responseMsg);
} // LassoLogin

View File

@ -1,51 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoLogout extends LassoProfile { // LassoLogout
public LassoLogout(LassoServer server, int providerType){
this.server = server;
init(server, providerType);
}
native protected void init(LassoServer server, int providerType);
native public int buildRequestMsg();
native public int buildResponseMsg();
native public String getNextProviderId();
native public int initRequest(String providerId);
native public int loadRequestMsg(String requestMsg, int requestMethod);
native public int processRequest();
native public int processResponseMsg(String responseMsg, int responseMethod);
} // LassoLogout

View File

@ -1,34 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public abstract class LassoNode extends LassoObject { // LassoNode
protected void finalize(){
destroy();
}
native protected void destroy();
} // LassoNode

View File

@ -1,33 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public abstract class LassoObject { // LassoObject
/** used to store ref to the c real object, this field must be used only by native methode */
protected long c_lasso_object = 0;
} // LassoObject

View File

@ -1,101 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public abstract class LassoProfile extends LassoObject { // LassoProfile
protected LassoIdentity identity = null;
protected LassoNode request = null;
protected LassoNode response = null;
protected LassoServer server = null;
protected LassoSession session = null;
native protected void getCIdentity();
native protected void getCRequest();
native protected void getCResponse();
native protected void getCServer();
native protected void getCSession();
native protected int setCIdentity();
native protected int setCSession();
public LassoIdentity getIdentity() {
getCIdentity();
return identity;
}
native public String getMsgBody();
native public String getMsgRelayState();
native public String getNameIdentifier();
native public String getMsgUrl();
native public String getProviderID();
public LassoNode getRequest() {
getCRequest();
return request;
}
native public int getRequestType();
public LassoNode getResponse() {
getCResponse();
return response;
}
native public int gettResponseType();
public LassoServer getServer() {
getCServer();
return server;
}
public LassoSession getSession() {
getCSession();
return session;
}
public int setIdentity(LassoIdentity identity) {
this.identity = identity;
return setCIdentity();
}
native public int setIdentityFromDump(String identityDump);
public int setSession(LassoSession session) {
this.session = session;
return setCSession();
}
native public int setSessionFromDump(String sessionDump);
} // LassoProfile

View File

@ -1,43 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoProvider extends LassoObject { // 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

View File

@ -1,37 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoRequest extends LassoNode { // LassoRequest
private LassoRequest() {}
public LassoRequest(String assertionArtifact){
init(assertionArtifact);
}
native protected void init(String assertionArtifact);
} // LassoRequest

View File

@ -1,36 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoResponse extends LassoNode { // LassoResponse
public LassoResponse(){
init();
}
native public void init();
} // LassoResponse

View File

@ -1,70 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
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);
protected void finalize(){
destroy();
}
/**
* 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();
native protected void destroy();
} // LassoServer

View File

@ -1,46 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
package com.entrouvert.lasso;
public class LassoSession extends LassoObject { // LassoSession
public LassoSession(){
init();
}
public LassoSession(String dump){
initFromDump(dump);
}
native protected void init();
native protected void initFromDump(String dump);
native public String dump();
native public String getAuthenticationMethod(String remoteProviderId);
} // LassoSession

View File

@ -1,40 +0,0 @@
/*
* JLasso -- Java bindings for Lasso library
*
* Copyright (C) 2004 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: Benjamin Poussin <poussin@codelutin.com>
* Emmanuel Raviart <eraviart@entrouvert.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
*/
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

3229
swig/Lasso.i Normal file

File diff suppressed because it is too large Load Diff