diff options
-rw-r--r-- | lasso/id-ff/lecp.c | 21 | ||||
-rw-r--r-- | lasso/id-ff/lecp.h | 6 | ||||
-rw-r--r-- | lasso/id-ff/login.c | 20 | ||||
-rw-r--r-- | lasso/id-ff/login.h | 6 | ||||
-rw-r--r-- | swig/Lasso.i | 9 |
5 files changed, 32 insertions, 30 deletions
diff --git a/lasso/id-ff/lecp.c b/lasso/id-ff/lecp.c index cf60e277..3879a59b 100644 --- a/lasso/id-ff/lecp.c +++ b/lasso/id-ff/lecp.c @@ -73,8 +73,6 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp) /** * lasso_lecp_build_authn_request_msg: * @lecp: a LassoLecp - * @remote_providerID: the providerID of the identity provider. When NULL, the first - * identity provider is used. * * Builds an authentication request. The data for the sending of the request are * stored in msg_url and msg_body (SOAP POST). @@ -82,7 +80,7 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp) * Return value: 0 on success and a negative value otherwise. **/ int -lasso_lecp_build_authn_request_msg(LassoLecp *lecp, const char *remote_providerID) +lasso_lecp_build_authn_request_msg(LassoLecp *lecp) { LassoProfile *profile; LassoProvider *remote_provider; @@ -90,11 +88,6 @@ lasso_lecp_build_authn_request_msg(LassoLecp *lecp, const char *remote_providerI g_return_val_if_fail(LASSO_IS_LECP(lecp), -1); profile = LASSO_PROFILE(lecp); - if (remote_providerID == NULL) { - profile->remote_providerID = lasso_server_get_first_providerID(profile->server); - } else { - profile->remote_providerID = g_strdup(remote_providerID); - } remote_provider = g_hash_table_lookup(profile->server->providers, profile->remote_providerID); @@ -196,8 +189,15 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp, return 0; } +/* + * lasso_lecp_init_authn_request: + * @lecp: a LassoLecp + * @remote_providerID: the providerID of the identity provider. When NULL, the first + * identity provider is used. + * + */ int -lasso_lecp_init_authn_request(LassoLecp *lecp) +lasso_lecp_init_authn_request(LassoLecp *lecp, const char *remote_providerID) { gint res; @@ -206,7 +206,8 @@ lasso_lecp_init_authn_request(LassoLecp *lecp) /* FIXME : BAD usage of http_method using POST method so that the lib:AuthnRequest is initialize with a signature template */ - res = lasso_login_init_authn_request(LASSO_LOGIN(lecp), LASSO_HTTP_METHOD_POST); + res = lasso_login_init_authn_request(LASSO_LOGIN(lecp), remote_providerID, + LASSO_HTTP_METHOD_POST); return res; } diff --git a/lasso/id-ff/lecp.h b/lasso/id-ff/lecp.h index 09eb1314..3aa78b13 100644 --- a/lasso/id-ff/lecp.h +++ b/lasso/id-ff/lecp.h @@ -66,8 +66,7 @@ LASSO_EXPORT LassoLecp* lasso_lecp_new(LassoServer *server); LASSO_EXPORT int lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp); -LASSO_EXPORT int lasso_lecp_build_authn_request_msg(LassoLecp *lecp, - const char *remote_providerID); +LASSO_EXPORT int lasso_lecp_build_authn_request_msg(LassoLecp *lecp); LASSO_EXPORT int lasso_lecp_build_authn_response_msg(LassoLecp *lecp); @@ -82,7 +81,8 @@ LASSO_EXPORT int lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp, LASSO_EXPORT void lasso_lecp_destroy(LassoLecp *lecp); -LASSO_EXPORT int lasso_lecp_init_authn_request(LassoLecp *lecp); +LASSO_EXPORT int lasso_lecp_init_authn_request(LassoLecp *lecp, + const char *remote_providerID); LASSO_EXPORT int lasso_lecp_process_authn_request_msg(LassoLecp *lecp, const char *authn_request_msg); diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c index ace5baea..b351b667 100644 --- a/lasso/id-ff/login.c +++ b/lasso/id-ff/login.c @@ -562,7 +562,7 @@ lasso_login_build_artifact_msg(LassoLogin *login, * Return value: 0 on success and a negative value otherwise. **/ gint -lasso_login_build_authn_request_msg(LassoLogin *login, const gchar *remote_providerID) +lasso_login_build_authn_request_msg(LassoLogin *login) { LassoProvider *provider, *remote_provider; char *md_authnRequestsSigned, *url, *query, *lareq, *protocolProfile; @@ -572,13 +572,6 @@ lasso_login_build_authn_request_msg(LassoLogin *login, const gchar *remote_provi g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); - if (remote_providerID != NULL) { - LASSO_PROFILE(login)->remote_providerID = g_strdup(remote_providerID); - } else { - LASSO_PROFILE(login)->remote_providerID = lasso_server_get_first_providerID( - LASSO_PROFILE(login)->server); - } - provider = LASSO_PROVIDER(LASSO_PROFILE(login)->server); remote_provider = g_hash_table_lookup(LASSO_PROFILE(login)->server->providers, LASSO_PROFILE(login)->remote_providerID); @@ -867,7 +860,8 @@ lasso_login_destroy(LassoLogin *login) } gint -lasso_login_init_authn_request(LassoLogin *login, lassoHttpMethod http_method) +lasso_login_init_authn_request(LassoLogin *login, const gchar *remote_providerID, + lassoHttpMethod http_method) { LassoLibAuthnRequest *request; @@ -877,8 +871,14 @@ lasso_login_init_authn_request(LassoLogin *login, lassoHttpMethod http_method) return error_code(G_LOG_LEVEL_CRITICAL, LASSO_PROFILE_ERROR_INVALID_HTTP_METHOD); } - login->http_method = http_method; + if (remote_providerID != NULL) { + LASSO_PROFILE(login)->remote_providerID = g_strdup(remote_providerID); + } else { + LASSO_PROFILE(login)->remote_providerID = lasso_server_get_first_providerID( + LASSO_PROFILE(login)->server); + } + login->http_method = http_method; /* XXX: should be moved somehow in samlp_request_abstract.c */ request = lasso_lib_authn_request_new(); diff --git a/lasso/id-ff/login.h b/lasso/id-ff/login.h index 3c91bacc..18e3c77b 100644 --- a/lasso/id-ff/login.h +++ b/lasso/id-ff/login.h @@ -85,8 +85,7 @@ LASSO_EXPORT gint lasso_login_build_artifact_msg(LassoLogin *login, const char *notOnOrAfter, lassoHttpMethod http_method); -LASSO_EXPORT gint lasso_login_build_authn_request_msg( - LassoLogin *login, const gchar *remote_providerID); +LASSO_EXPORT gint lasso_login_build_authn_request_msg(LassoLogin *login); LASSO_EXPORT gint lasso_login_build_authn_response_msg(LassoLogin *login, gboolean authentication_result, @@ -101,7 +100,8 @@ LASSO_EXPORT gint lasso_login_build_request_msg(LassoLogin *login); LASSO_EXPORT gint lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID); LASSO_EXPORT void lasso_login_destroy(LassoLogin *login); LASSO_EXPORT gchar* lasso_login_dump(LassoLogin *login); -LASSO_EXPORT gint lasso_login_init_authn_request(LassoLogin *login, lassoHttpMethod http_method); +LASSO_EXPORT gint lasso_login_init_authn_request(LassoLogin *login, + const gchar *remote_providerID, lassoHttpMethod http_method); LASSO_EXPORT gint lasso_login_init_request(LassoLogin *login, gchar *response_msg, lassoHttpMethod response_http_method); diff --git a/swig/Lasso.i b/swig/Lasso.i index f66cab66..2fef36f1 100644 --- a/swig/Lasso.i +++ b/swig/Lasso.i @@ -1627,7 +1627,7 @@ typedef struct { END_THROW_ERROR THROW_ERROR - void buildAuthnRequestMsg(gchar *remoteProviderId = NULL); + void buildAuthnRequestMsg(); END_THROW_ERROR THROW_ERROR @@ -1649,7 +1649,8 @@ typedef struct { gchar *dump(); THROW_ERROR - void initAuthnRequest(lassoHttpMethod httpMethod); + void initAuthnRequest(gchar *remoteProviderId = NULL, + lassoHttpMethod httpMethod = LASSO_HTTP_METHOD_REDIRECT); END_THROW_ERROR THROW_ERROR @@ -2153,7 +2154,7 @@ typedef struct { END_THROW_ERROR THROW_ERROR - void buildAuthnRequestMsg(gchar *remoteProviderId = NULL); + void buildAuthnRequestMsg(); END_THROW_ERROR THROW_ERROR @@ -2168,7 +2169,7 @@ typedef struct { END_THROW_ERROR THROW_ERROR - void initAuthnRequest(); + void initAuthnRequest(gchar *remoteProviderId = NULL); END_THROW_ERROR THROW_ERROR |