Hello,
We are having some
issues reading the attribute values present in SAML response.
We expect the following call to populate the Attributes collection, which it does, it populates the collection with Key names, but
no corresponding value??
var ssoResult = await SamlServiceProvider.ReceiveSsoAsync();Section of SAML response from trace looks like this...
<saml2:Subject xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">
[email protected]</saml2:NameID><saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml2:SubjectConfirmationData InResponseTo="_19aa28d3-3e9f-49bd-8f1b-8c9b62e3475e" NotOnOrAfter="2021-07-23T15:56:11.111Z" Recipient="
https://id.ssss.com/saml/assert"/></saml2:SubjectConfirmation></saml2:Subject><saml2:Conditions NotBefore="2021-07-23T15:46:11.111Z" NotOnOrAfter="2021-07-23T15:56:11.111Z" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><saml2:AudienceRestriction><saml2:Audience>Nepris-App</saml2:Audience></saml2:AudienceRestriction>
</saml2:Conditions><saml2:AuthnStatement AuthnInstant="2021-07-23T15:51:10.533Z" SessionIndex="_19aa28d3-3e9f-49bd-8f1b-8c9b62e3475e" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><saml2:AuthnContext>
<saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml2:AuthnContextClassRef></saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><saml2:Attribute Name="First" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"><saml2:AttributeValue xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Test User</saml2:AttributeValue></saml2:Attribute><saml2:Attribute Name="Last" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"><saml2:AttributeValue xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Last Name</saml2:AttributeValue></saml2:Attribute><saml2:Attribute Name="Email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"><saml2:AttributeValue xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
[email protected]</saml2:AttributeValue></saml2:Attribute><saml2:Attribute Name="Role" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"><saml2:AttributeValue xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Staff</saml2:AttributeValue></saml2:Attribute></saml2:AttributeStatement>
The result of
SamlServiceProvider.ReceiveSsoAsync() as JSON,
{
"__type": "ComponentSpace.Saml2.SpSsoResult, ComponentSpace.Saml2",
"partnerName": "
http://www.okta.com/XXXXXXXXXXXXXXX","isInResponseTo": true,
"userID": "
[email protected]",
"attributes": [{
"name": "First",
"nameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified",
"attributeValues": [{
"data": [
[]
],
"type": "xs:string",
"xmlAttributes": {
"xmlns:xs": "
http://www.w3.org/2001/XMLSchema","xmlns:xsi": "
http://www.w3.org/2001/XMLSchema-instance"}
}]
}, {
"name": "Last",
"nameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified",
"attributeValues": [{
"data": [
[]
],
"type": "xs:string",
"xmlAttributes": {
"xmlns:xs": "
http://www.w3.org/2001/XMLSchema","xmlns:xsi": "
http://www.w3.org/2001/XMLSchema-instance"}
}]
}, {
"name": "Email",
"nameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified",
"attributeValues": [{
"data": [
[]
],
"type": "xs:string",
"xmlAttributes": {
"xmlns:xs": "
http://www.w3.org/2001/XMLSchema","xmlns:xsi": "
http://www.w3.org/2001/XMLSchema-instance"}
}]
}, {
"name": "Role",
"nameFormat": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified",
"attributeValues": [{
"data": [
[]
],
"type": "xs:string",
"xmlAttributes": {
"xmlns:xs": "
http://www.w3.org/2001/XMLSchema","xmlns:xsi": "
http://www.w3.org/2001/XMLSchema-instance"}
}]
}],
"authnContext": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
"relayState": "{\"target\":\"/dashboard/my\",\"app\":\"v3\"}"
}
All and any help is greatly appreciated :)
Thanks,
Binu