Kentor AuthService - Read Subject NameID

2019-08-14 17:17发布

问题:

How can I access to saml2:NameID from saml2:Subject response XML node by using Kentor AuthService?

I couldn't find in code anything that deals with that part of XML. Maybe I'm missing something.

I'm not asking about Kentor IdP, I see that there NameID is sent as additional claim, which is translated as attribute, I'm asking in general, IdP does not have to be powered by Kentor, so I can't rely that I will have this value passed as attribute.

So, if it's handled I couldn't find it here: https://github.com/KentorIT/authservices/tree/master/Kentor.AuthServices

One option can be to parse XML on my own, but if there's already implemented or better solution that will be great.

回答1:

The Subject NameID is translated to a claim with type ClaimTypes.NameIdentifier (http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier).

It should be in the claims collection of the created claims identity.