Hi,
On 13 Jun 2014, at 19:13 pm, Akin <
akin...@gmail.com> wrote:
> Having some trouble with an SSO app that I'm writing where I try to retrieve the SAML session so that I can pull the user's attributes. However, when the user is redirected to my script, the user is again redirected to the IdP discovery page.
>
> Basically a user authentications with the client's IdP, My SP receives the response the redirects the user to my SSO script.
>
> In my script I try to create a session:
>
> $saml_config = SimpleSAML_Configuration::getInstance();
> $saml_session = SimpleSAML_Session::getInstance();
> $valid_saml_session = $saml_session->isValid(DEFAULT_SP);
Why are you doing that? You shouldn’t handle SimpleSAMLphp’s session manually. Please follow this instructions:
https://simplesamlphp.org/docs/stable/simplesamlphp-sp#section_6
Besides, where is this DEFAULT_SP constant coming from? Something you defined? Does it contain a string with the name of your authsource?
> However isValid() return false.
>
> And when the code gets down to
>
> $as->requireAuth(array('ReturnTo' => $return_to, 'ErrorURL' => $error_url));
Actually requireAuth() does exactly what you are trying to do with the call to isValid(). It will check if the user is already authenticated and return immediately if that’s the case. Apart from that, why are you passing the ReturnTo and ErrorURL parameters? Where does the $return_to variable point to?
Why do you want that? What you would normally want is that SimpleSAMLphp handles authentication for you transparently, and then use the attributes you get from it to discern which local user has authenticated and load the appropriate local session. Also bear in mind that you don’t need to “authenticate” the user into your application, and actually you can’t do that. You just identify him, and trust a third party (the IdP) to have properly verified the claimed identity.
> Any ideas as to what else I should check to diagnose this problem?
Follow the integration guide to use the normal API, and try again. If it still doesn’t work or you need something esoteric that is not covered by the common API, then ask here and we’ll try to figure out.
--
Jaime Pérez
UNINETT / Feide
mail:
jaime...@uninett.no
xmpp:
ja...@jabber.uninett.no
"Two roads diverged in a wood, and I, I took the one less traveled by, and that has made all the difference."
- Robert Frost