There is a special entry in the $state array (PersistentAuthData). That
entry lists which entries in the $state array should be passed to
authentication processing filters (and also which entries will be
available from $as->getAuthData() on the "SP" side).
E.g. (from modules/saml/www/sp/saml2-acs.php):
$state['saml:sp:IdP'] = $idp;
$state['PersistentAuthData'][] = 'saml:sp:IdP';
$state['saml:sp:NameID'] = $nameId;
$state['PersistentAuthData'][] = 'saml:sp:NameID';
Regards,
Olav Morken
UNINETT / Feide
Just to clear up what is actually happening here:
First of all, the setAttribute() and setAttributes()-functions are
deprecated. They only work for the "old-style" authentication sources,
where authentication was handled by the IdP redirecting to a web page.
What happens when you return from the authentication source is that the
session information is replaced with the data your authentication
source returns in its state array. Therefore the setAttribute-function
will not work.
--
You received this message because you are subscribed to the Google Groups "simpleSAMLphp" group.
To post to this group, send email to simple...@googlegroups.com.
To unsubscribe from this group, send email to simplesamlph...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simplesamlphp?hl=en.
$state['Auth.User'] = $user;$state['PersistentAuthData'][] = 'Auth.User';
The PersistentAuthData was only meant for authentication sources, and
not authentication processing filters, so it will not work.
I must say that I never considered the processing filters on the SP
side when adding "PersistentAuthData". SP processing filters are
invoked a bit differently from IdP processing filters.
Btw.: You should always use your module name as a prefix for any data
that you add to the state array, since that should avoid collisions.
My flow is currently like this:
- Authentication source is called, which is basically a clone of multiauth
- User authenticates, and then returns to idP
- Authproc filter queries my user service for an account that has the provided authentication data associated with it
- If an account does not exist, it redirects the user to a site to create one (or associate it with an existing one), then the user is returned to the authproc filter
- The authproc filter includes the user record with the authentication data
- User is sent back to the SP, along with their user record from my user service in the session
I suppose the authproc filter functionality could be moved to the authentication source itself--technically, the user should not be considered authenticated fully until their authentication record is associated with a user account anyway, so it would logically make sense. It's just such a complex operation that it seems to make sense to separate it from the basic authentication which is the first step.--
Ben
In that case it is a no-go, because authproc-filters are executed for
every authentication request the IdP receives. Updating authentication
data does not really make sense in that case.
I assume that your goal is to save some information until the next time
the filter is executed? In that case you may use setData on the session
object, e.g.:
$session = SimpleSAML_Session::getInstance();
$session->setData('yourmodule:somedata', $userID, 'Value that you want to save', SimpleSAML_Session::DATA_TIMEOUT_LOGOUT);
It can later be retrieved with getData():
$value = $session->getData('yourmodule:somedata', $userID);
Ah, you are trying to send data from the IdP to the SP through the
"AuthData" interface? That will not work. The "AuthData" is strictly
internal to the IdP or SP that it runs on.
Data sent from an IdP to an SP is usually transported through
attributes in the assertion that is sent as part of the authentication
response.
To attach an attribute, add it to the 'Attributes' entry in the
filter:
$state['Attributes']['SomeAttribute'] = array(
'SomeValue',
'SomeOtherValue',
This has to do with the way that attributes are transferred in the
SAML 2.0 standard. By default, an attribute is transmitted as the
following XML:
<saml:Attribute Name="somename" NameFormat="somenameformat">
<saml:AttributeValue xsi:type="xs:string">somevalue</saml:AttributeValue>
<saml:AttributeValue xsi:type="xs:string">someothervalue</saml:AttributeValue>
</saml:Attribute>
To transmitt multidimensional data through standard SAML 2.0 messages,
you will need to define a custom XML format for your data.
Unfortunately, support for this in simpleSAMLphp is incomplete. We
support transmitting custom XML, but not parsing it.
One simple alternative may be to flatten your data structure to a
single associative array:
$state['Attributes']['User:id'] = array( 'userid...' );
$state['Attributes']['Profile:phone'] = array( '+4712345678' );
A different alternative, which may be a bit ugly, would be to use JSON:
$state['Attributes']['user'] = array( json_encode($user) );