summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Laniel <dlaniel@entrouvert.com>2007-05-02 15:08:34 +0000
committerDamien Laniel <dlaniel@entrouvert.com>2007-05-02 15:08:34 +0000
commite8298f42788f9164ecd890b541a797892a788e21 (patch)
tree85b3abf04a87e80f525ee2571b304acd64d54c9d
parent31e4437cf5b762ec10ef367b4f06f13c2f869426 (diff)
downloadlasso-e8298f42788f9164ecd890b541a797892a788e21.tar.gz
lasso-e8298f42788f9164ecd890b541a797892a788e21.tar.xz
lasso-e8298f42788f9164ecd890b541a797892a788e21.zip
get assertion from disco epr and put this assertion into soap header for metadata_association_add
-rw-r--r--lasso/id-ff/identity.c21
-rw-r--r--lasso/id-wsf-2.0/discovery.c28
-rw-r--r--lasso/saml-2.0/login.c9
3 files changed, 28 insertions, 30 deletions
diff --git a/lasso/id-ff/identity.c b/lasso/id-ff/identity.c
index 5663f831..2184681b 100644
--- a/lasso/id-ff/identity.c
+++ b/lasso/id-ff/identity.c
@@ -272,8 +272,14 @@ lasso_identity_add_endpoint_reference(LassoIdentity *identity, LassoWsAddrEndpoi
LassoWsAddrEndpointReference*
lasso_identity_get_endpoint_reference(LassoIdentity *identity, const gchar *service_type)
{
- return LASSO_WSA_ENDPOINT_REFERENCE(g_hash_table_lookup(
- identity->private_data->eprs, service_type));
+ LassoWsAddrEndpointReference* epr;
+
+ epr = g_hash_table_lookup(identity->private_data->eprs, service_type);
+ if (LASSO_IS_WSA_ENDPOINT_REFERENCE(epr)) {
+ return LASSO_WSA_ENDPOINT_REFERENCE(epr);
+ } else {
+ return NULL;
+ }
}
LassoSaml2Assertion*
@@ -287,14 +293,19 @@ lasso_identity_get_assertion_identity_token(LassoIdentity *identity)
LassoSaml2Assertion *assertion = NULL;
epr = lasso_identity_get_endpoint_reference(identity, LASSO_IDWSF2_DISCO_HREF);
+ if (! LASSO_IS_WSA_ENDPOINT_REFERENCE(epr)) {
+ return NULL;
+ }
+
metadata_item = epr->Metadata->any;
for (i = g_list_first(metadata_item); i != NULL; i = g_list_next(i)) {
- if (LASSO_IS_IDWSF2_DISCO_SECURITY_CONTEXT(i)) {
- security_context = LASSO_IDWSF2_DISCO_SECURITY_CONTEXT(i);
+ if (LASSO_IS_IDWSF2_DISCO_SECURITY_CONTEXT(i->data)) {
+ security_context = LASSO_IDWSF2_DISCO_SECURITY_CONTEXT(i->data);
if (security_context->Token != NULL) {
sec_token = security_context->Token->data;
if (LASSO_IS_SAML2_ASSERTION(sec_token->any)) {
- assertion = LASSO_SAML2_ASSERTION(sec_token->any);
+ assertion = LASSO_SAML2_ASSERTION(
+ g_object_ref(sec_token->any));
break;
}
}
diff --git a/lasso/id-wsf-2.0/discovery.c b/lasso/id-wsf-2.0/discovery.c
index e2c50245..eeab1bb9 100644
--- a/lasso/id-wsf-2.0/discovery.c
+++ b/lasso/id-wsf-2.0/discovery.c
@@ -215,7 +215,6 @@ lasso_idwsf2_discovery_init_metadata_association_add(LassoIdWsf2Discovery *disco
LassoIdWsf2DiscoSvcMDAssociationAdd *md_association_add;
LassoSoapEnvelope *envelope;
LassoSaml2Assertion *assertion;
- LassoFederation *federation;
LassoWsse200401Security *wsse_security;
g_return_val_if_fail(LASSO_IS_IDWSF2_DISCOVERY(discovery),
@@ -231,28 +230,15 @@ lasso_idwsf2_discovery_init_metadata_association_add(LassoIdWsf2Discovery *disco
lasso_wsf2_profile_init_soap_request(profile, LASSO_NODE(md_association_add));
/* Identity token */
- assertion = LASSO_SAML2_ASSERTION(lasso_saml2_assertion_new());
- assertion->Subject = LASSO_SAML2_SUBJECT(lasso_saml2_subject_new());
- assertion->Subject->SubjectConfirmation = LASSO_SAML2_SUBJECT_CONFIRMATION(
- lasso_saml2_subject_confirmation_new());
- assertion->Subject->SubjectConfirmation->Method = g_strdup(
- LASSO_SAML2_CONFIRMATION_METHOD_BEARER);
- federation = lasso_identity_get_federation(identity, disco_provider_id);
- if (federation != NULL) {
- if (federation->remote_nameIdentifier) {
- assertion->Subject->NameID = g_object_ref(
- federation->remote_nameIdentifier);
- } else {
- assertion->Subject->NameID = g_object_ref(
- federation->local_nameIdentifier);
- }
- }
+ assertion = lasso_identity_get_assertion_identity_token(identity);
- wsse_security = lasso_wsse_200401_security_new();
- wsse_security->any = g_list_append(wsse_security->any, assertion);
+ if (assertion != NULL) {
+ wsse_security = lasso_wsse_200401_security_new();
+ wsse_security->any = g_list_append(wsse_security->any, assertion);
- envelope = profile->soap_envelope_request;
- envelope->Header->Other = g_list_append(envelope->Header->Other, wsse_security);
+ envelope = profile->soap_envelope_request;
+ envelope->Header->Other = g_list_append(envelope->Header->Other, wsse_security);
+ }
/* FIXME : Get the url of the disco service where we must send the soap request */
/* LASSO_WSF2_PROFILE(discovery)->msg_url = g_strdup(disco_provider_id); */
diff --git a/lasso/saml-2.0/login.c b/lasso/saml-2.0/login.c
index 24292b96..44eaf9d2 100644
--- a/lasso/saml-2.0/login.c
+++ b/lasso/saml-2.0/login.c
@@ -1245,20 +1245,21 @@ lasso_saml20_login_copy_assertion_epr(LassoLogin *login)
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), LASSO_PROFILE_ERROR_IDENTITY_NOT_FOUND);
- assertion = LASSO_SAMLP2_RESPONSE(profile->response)->Assertion->data;
+ assertion = LASSO_SAML2_ASSERTION(
+ LASSO_SAMLP2_RESPONSE(profile->response)->Assertion->data);
attribute_statement_item = assertion->AttributeStatement;
if (attribute_statement_item == NULL || g_list_length(attribute_statement_item) == 0) {
return 0;
}
-
+
attribute_statement = LASSO_SAML2_ATTRIBUTE_STATEMENT(attribute_statement_item->data);
attribute = LASSO_SAML2_ATTRIBUTE(attribute_statement->Attribute->data);
attribute_value = LASSO_SAML2_ATTRIBUTE_VALUE(attribute->AttributeValue->data);
attribute_value_item = attribute_value->any;
for (i = g_list_first(attribute_value_item); i != NULL; i = g_list_next(i)) {
- if (LASSO_IS_WSA_ENDPOINT_REFERENCE(attribute_value_item->data)) {
- epr = LASSO_WSA_ENDPOINT_REFERENCE(attribute_value_item->data);
+ if (LASSO_IS_WSA_ENDPOINT_REFERENCE(i->data)) {
+ epr = LASSO_WSA_ENDPOINT_REFERENCE(i->data);
lasso_identity_add_endpoint_reference(identity, epr);
}
}