Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Hi,

How to convert ClaimsPrincipal instance to SAML XML token
Posted

1 solution

You can try to use the Saml11SecurityTokenHandler's ReadToken method as below;
Saml11SecurityTokenHandler handlerToken = new Saml11SecurityTokenHandler();
handlerToken.Configuration = new   Microsoft.IdentityModel.Tokens.SecurityTokenHandlerConfiguration();
XmlReader reader = XmlReader.Create(new StringReader(yourSamlTokenString));
SecurityToken samlSecurityToken = handlerToken.ReadToken(reader);
ClaimsIdentityCollection claimIdentity = handlerToken.ValidateToken(samlSecurityToken );


Reference: https://msdn.microsoft.com/en-us/library/microsoft.identitymodel.tokens.saml11.saml11securitytokenhandler.validatetoken.aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900