I have a problem with checking the security token, I also tried to use your code and others, but when it tries to check the ST, I have an error: ID4175: The security token issuer was not recognized by the NameRegistry issuer. To accept security tokens from this issuer, set the IssuerNameRegistry property to the correct name for this issuer
I don't know how hot the web config config is, can you help me?
this is the code:
//Microsoft.IdentityModel.Configuration.ServiceConfiguration serviceConfig = new Microsoft.IdentityModel.Configuration.ServiceConfiguration ();
// Now read the token and convert it to an IPrincipal System.IdentityModel.Tokens.SecurityToken theToken = null; ClaimsIdentityCollection claimsIdentity = null; using (XmlReader reader2 = XmlReader.Create(new StringReader(samlTokenXml))) { theToken = serviceConfig.SecurityTokenHandlers.ReadToken(reader2); claimsIdentity = serviceConfig.SecurityTokenHandlers.ValidateToken(theToken); } IPrincipal principal = new ClaimsPrincipal(claimsIdentity);
Thank's peppe
source share