[profile] prefer to lookup the session before the identity for looking up a name identifier;

This commit is contained in:
Benjamin Dauvergne 2010-12-17 17:40:07 +01:00
parent d02bf096a5
commit 8c28926304
1 changed files with 14 additions and 14 deletions

View File

@ -115,6 +115,20 @@ lasso_profile_get_nameIdentifier(LassoProfile *profile)
if (profile->remote_providerID == NULL)
return NULL;
/* For transient federations, we must look at assertions no federation object exists */
if (LASSO_IS_SESSION(profile->session)) {
LassoNode *assertion, *name_id;
assertion = lasso_session_get_assertion(profile->session,
profile->remote_providerID);
name_id = _lasso_saml_assertion_get_name_id((LassoSamlAssertion*)assertion);
if (name_id)
return name_id;
name_id = _lasso_saml2_assertion_get_name_id((LassoSaml2Assertion*)assertion);
if (name_id)
return name_id;
}
/* beware, it is not a real loop ! */
if (LASSO_IS_IDENTITY(profile->identity)) do {
remote_provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
@ -136,20 +150,6 @@ lasso_profile_get_nameIdentifier(LassoProfile *profile)
return federation->local_nameIdentifier;
} while (FALSE);
/* For transient federations, we must look at assertions no federation object exists */
if (LASSO_IS_SESSION(profile->session)) {
LassoNode *assertion, *name_id;
assertion = lasso_session_get_assertion(profile->session,
profile->remote_providerID);
name_id = _lasso_saml_assertion_get_name_id((LassoSamlAssertion*)assertion);
if (name_id)
return name_id;
name_id = _lasso_saml2_assertion_get_name_id((LassoSaml2Assertion*)assertion);
if (name_id)
return name_id;
}
return NULL;
}