Actually, having received a valid SAMLResponse counts as authenticated
from the simpleSAMLphp SPs point of view. It does not have a concept of
user database or anything like that. (That is the applications job :)
What you are describing is IdP initiated authentication / IdP first
flow. This is where the IdP sends an unsolicited authentication
response to the SP. (Unsolicited since the SP hasn't sent an
authentication request to the IdP first.)
This is supported by simpleSAMLphp, and the requireAuth()-function
should just return in that case. So, my guess is that something else
isn't working correctly for you. Have you checked the simpleSAMLphp
log? (By default logged to syslog, so you can find it in
/var/log/syslog , /var/log/messages or something like that. You may
also want to increase the logging level in config/config.php .
Best regards,
Olav Morken
UNINETT / Feide
This does not really make sense - you cannot add an IdP-initiated
authentication URL here. Also, wasn't your IdP using PingFederated?
That URL is for a simpleSAMLphp IdP.
Also, your SP's entityID is unlikely to be
"http://testing.gf.com/saml/module.php/saml/sp/saml2-acs.php/default-sp".
That looks like your SPs AssertionConsumerService endpoint. (Of course,
nothing prevents you from reusing the same URI as an entityID, but it
will lead to confusion for everyone that looks at your SP
configuration.)
> *Note that we have added the spentityid variable to have it working as
> IdP initiated response.
If the IdP does not support SP initiated authentication, there should
not be a SingleSignOnService endpoint for it. The SingleSignOnService
endpoint is only used for SP initiated authentication.
> Even doing so, the system still attempts to redirect to the IdP to
> enter credentials on the IdP site in order to be transferred to the
> SP.
>
> We see this in the log:
> Jan 18 14:35:39 simplesamlphp NOTICE [af7e44ebd6] Session: 'default-
> sp' not valid because we are not authenticated.
> Jan 18 14:35:39 simplesamlphp NOTICE [af7e44ebd6] Saved state:
> '_2e556991f2385b6780019808a033341eff20a0c106'
> Jan 18 14:35:39 simplesamlphp NOTICE [af7e44ebd6] Sending SAML 2
> AuthnRequest to 'partner.com:saml2.0'
I do not see any log messages from when the IdP sent the unsolicited
resposne to your SP. Are you sure that it was sent?
> Two questions:
>
> 1. Is it possible to have IdP initiated first setup where user does
> not have to enter credentials (username/password) on the IdP after the
> SAMLResponse has been sent to SP?
Yes, that is the way it normally works.
> 2. In case of an IdP-first response, the test would be to POST
> SAMLResponse directly access the above link right? Or would there be
> any other way of testing an IdP-first response?
What link? The IdP must send the unsolicited response message to your
SPs AssertionConsumerService endpoint. Typically that is configured at
the IdP.
> To make it work with IdP first initiated, we have a simple form which
> will pass the SAMLResponse to the SP (the spentityID is present)
>
> <?php
> echo '<form action="http://testmachine/simplesaml/saml2/idp/
> SSOService.php?spentityid=http://testing.gf.com/saml/module.php/saml/
> sp/metadata.php/default-sp" method="post">';
> echo '<br />SAML Response<textarea rows="30" cols="50"
> name="SAMLResponse"></textarea>';
> echo '<br /><input type="submit" value="Please Post via IdP." />';
> echo '</form>';
>
> As mentioned before, the SP first works perfectly. Could you take a
> look at and let us know what/where is the issue for IdP first not
> being authenticated?
>
> Is our way of testing by having a simple form post to the page:
>
> http://testmachine/simplesaml/saml2/idp/SSOService.php?spentityid=http://testing.gf.com/saml/module.php/saml/sp/metadata.php/default-sp
> valid?
This will not work. The IdP does not accept a SAML 2.0 response.
Instead, the IdP generates a SAML 2.0 response. Thus sending a SAML 2.0
response to the IdPs SingleSignOnService endpoint does not really make
sense.
Instead, to test IdP initiated SSO, trigger the SSO endpoint with a
normal request:
Yes, you will be asked for a username and password, but that is because
the IdP needs to authenticate the user somehow. If you (for testing
purposes) do not want to see a login form, change the authentication
source to something like exampleauth:Static.