Extract NameID value instead of Attribute

Michael Weishaar busch at datenschleuder.com
Mon Feb 6 07:04:39 UTC 2023


Hello shibboleth users,

I am using shibboleth service provider and apache2 to authenticate users via SAML.

This is how the SAML response from my identity provider looks like:

[...]
<Subject>
	<NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">MyFirstName.MyLastName at MyCompany.com</NameID> 			<— Extracting this does not work
	<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer”>
	<SubjectConfirmationData InResponseTo="_bc0d14e8ae5d02d7da7339d2cec3ad12" NotOnOrAfter="2023-02-06T07:43:47.917Z" Recipient="https://myapp.example.com/Shibboleth.sso/SAML2/POST"></SubjectConfirmationData>
	</SubjectConfirmation>
</Subject>
	<Conditions NotBefore="2023-02-06T06:38:47.917Z" NotOnOrAfter="2023-02-06T07:43:47.917Z”>
	<AudienceRestriction>
	<Audience>https://myapp.example.com</Audience>
	</AudienceRestriction>
</Conditions>
<AttributeStatement>
	<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname”>
		<AttributeValue>MyFirstName</AttributeValue>
	</Attribute>
	<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname”>
		<AttributeValue>MyLastName</AttributeValue>
	</Attribute>
	<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress”>
		<AttributeValue>MyFirstName.MyLastName at MyCompany.com</AttributeValue> 			<— Extracting this does work
	</Attribute>
</AttributeStatement>
[...]

I can successfully extract the AttributeValue of "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress” using the following attribute-map.xml:

<Attributes xmlns="urn:mace:shibboleth:2.0:attribute-map” xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Attribute nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified" name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" id="uid"/>
</Attributes>

However, what I actually want is to extract the Subject NameID value instead. However, it does not work using this attribute-map.xml:

<Attributes xmlns="urn:mace:shibboleth:2.0:attribute-map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”>
	<Attribute nameFormat="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" id="uid"/>
</Attributes>

I was not able to find documentation about how to extract the NameID value. Can somebody point me in the right direction?


-- 
Kind Regards, 
Michael



More information about the users mailing list