diff options
| author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-07-01 02:11:16 +0000 |
|---|---|---|
| committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-07-01 02:11:16 +0000 |
| commit | 6bdf97f01ddde750415b02cb1e235d836d125e1a (patch) | |
| tree | 7deb1cb99e495ae1c5991aab675a9d9e286005e8 | |
| parent | ddc3dafdabb81f1a4e7b40f17b6d47f9cf236cbf (diff) | |
| download | lasso-6bdf97f01ddde750415b02cb1e235d836d125e1a.tar.gz lasso-6bdf97f01ddde750415b02cb1e235d836d125e1a.tar.xz lasso-6bdf97f01ddde750415b02cb1e235d836d125e1a.zip | |
*** empty log message ***
| -rw-r--r-- | lasso/id-ff/authentication.c | 39 | ||||
| -rw-r--r-- | lasso/id-ff/authentication.h | 12 | ||||
| -rw-r--r-- | lasso/id-ff/profile_context.c | 32 | ||||
| -rw-r--r-- | lasso/id-ff/profile_context.h | 3 |
4 files changed, 41 insertions, 45 deletions
diff --git a/lasso/id-ff/authentication.c b/lasso/id-ff/authentication.c index 1c5d0132..c3909045 100644 --- a/lasso/id-ff/authentication.c +++ b/lasso/id-ff/authentication.c @@ -41,7 +41,7 @@ lasso_authentication_build_request_msg(LassoAuthentication *authn) { LassoProvider *provider; xmlChar *request_protocolProfile, *url, *query; - gchar *request_msg; + gchar *msg; gboolean must_sign; provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(authn)->server, @@ -64,8 +64,8 @@ lasso_authentication_build_request_msg(LassoAuthentication *authn) query = lasso_node_export_to_query(LASSO_PROFILE_CONTEXT(authn)->request, 0, NULL); } /* alloc returned string +2 for the ? and \0 */ - request_msg = (gchar *) g_new(gchar, strlen(url) + strlen(query) + 2); - g_sprintf(request_msg, "%s?%s", url, query); + msg = (gchar *) g_new(gchar, strlen(url) + strlen(query) + 2); + g_sprintf(msg, "%s?%s", url, query); g_free(url); g_free(query); } @@ -74,7 +74,7 @@ lasso_authentication_build_request_msg(LassoAuthentication *authn) printf("TODO - export the AuthnRequest in a formular\n"); } - return (request_msg); + return (msg); } static void @@ -186,10 +186,12 @@ gchar * lasso_authentication_build_response_msg(LassoAuthentication *authn, gint authentication_result, const gchar *authenticationMethod, - const gchar *reauthenticateOnOrAfter) + const gchar *reauthenticateOnOrAfter, + gint method) { LassoUser *user; - xmlChar *str, *nameIDPolicy, *protocolProfile; + gchar *msg; + xmlChar *nameIDPolicy, *protocolProfile; LassoNode *assertion, *authentication_statement, *idpProvidedNameIdentifier; LassoIdentity *identity; @@ -243,13 +245,17 @@ lasso_authentication_build_response_msg(LassoAuthentication *authn, if (xmlStrEqual(authn->protocolProfile, lassoLibProtocolProfilePost)) { /* return an authnResponse (base64 encoded) */ - str = lasso_node_export_to_base64(LASSO_PROFILE_CONTEXT(authn)->response); + msg = lasso_node_export_to_base64(LASSO_PROFILE_CONTEXT(authn)->response); } - else if (xmlStrEqual(protocolProfile, lassoLibProtocolProfileArtifact)) { + else if (xmlStrEqual(authn->protocolProfile, lassoLibProtocolProfileArtifact)) { /* return an artifact */ - switch (authn->response_method) { + switch (method) { case lassoProfileContextMethodRedirect: - /* return query */ + /* return query (base64 encoded) */ + /* liberty-idff-bindings-profiles-v1.2.pdf p.25 */ + msg = g_new(gchar, 2+20+20+1); + sprintf(msg, "%c%c%s%s", 0, 3, "01234567890123456789", "01234567890123456789"); + msg = xmlSecBase64Encode(msg, 42, 0); break; case lassoProfileContextMethodPost: /* return a formular */ @@ -262,7 +268,7 @@ lasso_authentication_build_response_msg(LassoAuthentication *authn, break; } - return(str); + return (msg); } xmlChar* @@ -320,14 +326,12 @@ GType lasso_authentication_get_type() { sizeof (LassoAuthenticationClass), NULL, NULL, -/* (GClassInitFunc) lasso_authentication_class_init, */ - NULL, + (GClassInitFunc) lasso_authentication_class_init, NULL, NULL, sizeof(LassoAuthentication), 0, -/* (GInstanceInitFunc) lasso_authentication_instance_init, */ - NULL, + (GInstanceInitFunc) lasso_authentication_instance_init, }; this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT, @@ -367,11 +371,6 @@ lasso_authentication_new(LassoServer *server, authn->request = lasso_authn_request_new(authn->local_providerID); } else if (request_msg != NULL) { - /* - rebuild request - create response (LibAuthnResponse or SamlpResponse) - verify request signature -> modify response status if need - */ lasso_authentication_process_request(LASSO_AUTHENTICATION(authn), request_msg); } else if (response_msg != NULL) { diff --git a/lasso/id-ff/authentication.h b/lasso/id-ff/authentication.h index c8445d27..27cb377f 100644 --- a/lasso/id-ff/authentication.h +++ b/lasso/id-ff/authentication.h @@ -73,16 +73,16 @@ LASSO_EXPORT LassoProfileContext* lasso_authentication_new (L LASSO_EXPORT gchar* lasso_authentication_build_request_msg (LassoAuthentication *authn); -LASSO_EXPORT xmlChar* lasso_authentication_process_artifact (LassoAuthentication *authn, - gchar *artifact); - -LASSO_EXPORT gboolean lasso_authentication_process_response (LassoAuthentication *authn, - xmlChar *response); - LASSO_EXPORT gchar* lasso_authentication_process_authentication_result (LassoAuthentication *authn, gint authentication_result, const char *authentication_method); +LASSO_EXPORT gchar* lasso_authentication_build_response_msg (LassoAuthentication *authn, + gint authentication_result, + const gchar *authenticationMethod, + const gchar *reauthenticateOnOrAfter, + gint method); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/lasso/id-ff/profile_context.c b/lasso/id-ff/profile_context.c index 257a192c..9a1e9e29 100644 --- a/lasso/id-ff/profile_context.c +++ b/lasso/id-ff/profile_context.c @@ -83,7 +83,6 @@ lasso_profile_context_set_response_status(LassoProfileContext *ctx, lasso_node_destroy(status); } - /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -101,10 +100,11 @@ lasso_profile_context_instance_init(GTypeInstance *instance, { LassoProfileContext *ctx = LASSO_PROFILE_CONTEXT(instance); - ctx->user = NULL; + ctx->server = NULL; + ctx->user = NULL; ctx->request = NULL; ctx->response = NULL; - ctx->local_providerID = NULL; + ctx->local_providerID = NULL; ctx->remote_providerID = NULL; } @@ -118,12 +118,16 @@ lasso_profile_context_set_property (GObject *object, switch (property_id) { case LASSO_PROFILE_CONTEXT_SERVER: { - g_object_unref(self->server); + if (self->server) { + g_object_unref(self->server); + } self->server = g_value_get_pointer (value); } break; case LASSO_PROFILE_CONTEXT_USER: { - g_object_unref(self->user); + if (self->user) { + g_object_unref(self->user); + } self->user = g_value_get_pointer (value); } break; @@ -157,7 +161,6 @@ lasso_profile_context_class_init(gpointer g_class, gpointer g_class_data) { GObjectClass *gobject_class = G_OBJECT_CLASS (g_class); - LassoProfileContextClass *klass = LASSO_PROFILE_CONTEXT_CLASS (g_class); GParamSpec *pspec; gobject_class->set_property = lasso_profile_context_set_property; @@ -227,21 +230,18 @@ lasso_profile_context_new(LassoServer *server, gchar *local_providerID, gchar *remote_providerID) { - /* load the ProviderID name or a reference to the provider ? */ + g_return_val_if_fail(server != NULL, NULL); g_return_val_if_fail(local_providerID != NULL, NULL); g_return_val_if_fail(remote_providerID != NULL, NULL); LassoProfileContext *ctx; - ctx = g_object_new(LASSO_TYPE_PROFILE_CONTEXT, - "server", server, - "user", user, - "local_providerID", local_providerID, - "remote_providerID", remote_providerID, - NULL); - -/* lasso_profile_context_set_local_providerID(ctx, local_providerID); */ -/* lasso_profile_context_set_remote_providerID(ctx, remote_providerID); */ + ctx = LASSO_PROFILE_CONTEXT(g_object_new(LASSO_TYPE_PROFILE_CONTEXT, + "server", server, + "user", user, + "local_providerID", local_providerID, + "remote_providerID", remote_providerID, + NULL)); return (ctx); } diff --git a/lasso/id-ff/profile_context.h b/lasso/id-ff/profile_context.h index fa4ac6d6..7f0c49da 100644 --- a/lasso/id-ff/profile_context.h +++ b/lasso/id-ff/profile_context.h @@ -65,9 +65,6 @@ struct _LassoProfileContext { gchar *local_providerID; gchar *remote_providerID; - -/* gint request_protocol_method; */ -/* gint status; */ /*< private >*/ }; |
