summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lasso/id-ff/profile.h3
-rw-r--r--python/lasso.py29
-rw-r--r--swig/Lasso.i40
3 files changed, 61 insertions, 11 deletions
diff --git a/lasso/id-ff/profile.h b/lasso/id-ff/profile.h
index 69d2b26a..8beae40f 100644
--- a/lasso/id-ff/profile.h
+++ b/lasso/id-ff/profile.h
@@ -61,7 +61,8 @@ typedef enum {
} lassoRequestType;
typedef enum {
- lassoHttpMethodGet = 1,
+ lassoHttpMethodAny = 0,
+ lassoHttpMethodGet,
lassoHttpMethodPost,
lassoHttpMethodRedirect,
lassoHttpMethodSoap
diff --git a/python/lasso.py b/python/lasso.py
index 73aff94f..89160616 100644
--- a/python/lasso.py
+++ b/python/lasso.py
@@ -92,6 +92,9 @@ class ErrorUnknown(Error):
return 'Unknown error number %d in Lasso function %s' % (self.code, self.functionName)
+# Binding specific errors
+
+
class ErrorLassoAlreadyInitialized(Error):
code = 1
msg = 'Lasso already initialized'
@@ -135,9 +138,22 @@ class ErrorUnknownResponseType(Error):
self.responseType, self.functionName)
+# Lasso errors
+
+
+class LogoutErrorUnsupportedProfile(Error):
+ code = lassomod.LASSO_LOGOUT_ERROR_UNSUPPORTED_PROFILE
+
+ def __str__(self):
+ return 'Unsupported logout profile in Lasso function %s()' % self.functionName
+
+
def newError(code, functionName):
# FIXME: Use proper ErrorClass, when Lasso will have well defined error codes.
- return ErrorUnknown(code, functionName)
+ if code == lassomod.LASSO_LOGOUT_ERROR_UNSUPPORTED_PROFILE:
+ return LogoutErrorUnsupportedProfile(functionName)
+ else:
+ return ErrorUnknown(code, functionName)
################################################################################
@@ -455,8 +471,9 @@ class Defederation(_ObjectMixin, lassomod.LassoDefederation, _ProfileChild):
if errorCode:
raise newError(errorCode, 'lasso_defederation_build_notification_msg')
- def init_notification(self, remote_providerID = None):
- errorCode = lassomod.lasso_defederation_init_notification(self, remote_providerID)
+ def init_notification(self, remote_providerID, notification_method = httpMethodAny):
+ errorCode = lassomod.lasso_defederation_init_notification(
+ self, remote_providerID, notification_method)
if errorCode:
raise newError(errorCode, 'lasso_defederation_init_notification')
@@ -535,7 +552,7 @@ class Login(_ObjectMixin, lassomod.LassoLogin, _ProfileChild):
if errorCode:
raise newError(errorCode, 'lasso_login_init_from_authn_request_msg')
- def init_request(self, response_msg, response_http_method):
+ def init_request(self, response_msg, response_http_method = httpMethodRedirect):
errorCode = lassomod.lasso_login_init_request(self, response_msg, response_http_method)
if errorCode:
raise newError(errorCode, 'lasso_login_init_request')
@@ -581,8 +598,8 @@ class Logout(_ObjectMixin, lassomod.LassoLogout, _ProfileChild):
def get_next_providerID(self):
return lassomod.lasso_logout_get_next_providerID(self)
- def init_request(self, remote_providerID = None):
- errorCode = lassomod.lasso_logout_init_request(self, remote_providerID)
+ def init_request(self, remote_providerID, request_method = httpMethodAny):
+ errorCode = lassomod.lasso_logout_init_request(self, remote_providerID, request_method)
if errorCode:
raise newError(errorCode, 'lasso_logout_init_request')
diff --git a/swig/Lasso.i b/swig/Lasso.i
index b71ff5fd..bfa8911f 100644
--- a/swig/Lasso.i
+++ b/swig/Lasso.i
@@ -126,7 +126,8 @@ int lasso_shutdown(void);
typedef enum {
- lassoHttpMethodGet = 1,
+ lassoHttpMethodAny = 0,
+ lassoHttpMethodGet,
lassoHttpMethodPost,
lassoHttpMethodRedirect,
lassoHttpMethodSoap
@@ -209,6 +210,36 @@ typedef enum {
} lassoSignatureMethod;
+/* Errors */
+#define LASSO_XML_ERROR_NODE_NOTFOUND -10
+#define LASSO_XML_ERROR_NODE_CONTENT_NOTFOUND -11
+#define LASSO_XML_ERROR_ATTR_NOTFOUND -12
+#define LASSO_XML_ERROR_ATTR_VALUE_NOTFOUND -13
+
+#define LASSO_DS_ERROR_SIGNATURE_TMPL_CREATION_FAILED -101
+#define LASSO_DS_ERROR_CONTEXT_CREATION_FAILED -102
+#define LASSO_DS_ERROR_PUBLIC_KEY_LOAD_FAILED -103
+#define LASSO_DS_ERROR_PRIVATE_KEY_LOAD_FAILED -104
+#define LASSO_DS_ERROR_CERTIFICATE_LOAD_FAILED -105
+#define LASSO_DS_ERROR_SIGNATURE_FAILED -106
+#define LASSO_DS_ERROR_SIGNATURE_NOTFOUND -107
+#define LASSO_DS_ERROR_KEYS_MNGR_CREATION_FAILED -108
+#define LASSO_DS_ERROR_KEYS_MNGR_INIT_FAILED -109
+#define LASSO_DS_ERROR_SIGNATURE_VERIFICATION_FAILED -110
+#define LASSO_DS_ERROR_INVALID_SIGNATURE -111
+
+#define LASSO_SERVER_ERROR_PROVIDER_NOTFOUND -201
+#define LASSO_SERVER_ERROR_ADD_PROVIDER_FAILED -202
+
+#define LASSO_LOGOUT_ERROR_UNSUPPORTED_PROFILE -301
+
+#define LASSO_PARAM_ERROR_BADTYPE_OR_NULL_OBJ -501
+#define LASSO_PARAM_ERROR_INVALID_VALUE -502
+#define LASSO_PARAM_ERROR_ERR_CHECK_FAILED -503
+
+#define LASSO_ERROR_UNDEFINED -999
+
+
/***********************************************************************
***********************************************************************
* XML
@@ -572,8 +603,8 @@ void lasso_defederation_destroy(LassoDefederation *defederation);
gint lasso_defederation_build_notification_msg(LassoDefederation *defederation);
gint lasso_defederation_init_notification(LassoDefederation *defederation,
- gchar *remote_providerID,
- lassoHttpMethod notification_method);
+ gchar *remote_providerID,
+ lassoHttpMethod notification_method);
gint lasso_defederation_process_notification_msg(LassoDefederation *defederation,
gchar *notification_msg,
@@ -690,7 +721,8 @@ gint lasso_logout_build_response_msg(LassoLogout *logout);
%newobject lasso_logout_get_next_providerID;
gchar* lasso_logout_get_next_providerID (LassoLogout *logout);
-gint lasso_logout_init_request(LassoLogout *logout, gchar *remote_providerID, lassoHttpMethod request_method);
+gint lasso_logout_init_request(LassoLogout *logout, gchar *remote_providerID,
+ lassoHttpMethod request_method);
gint lasso_logout_process_request_msg(LassoLogout *logout, gchar *request_msg,
lassoHttpMethod request_method);