Web.config converts saml security token to main application

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

0
source share
1 answer

WIF has the ConfigurationBasedIssuerNameRegistry class, where you can map the signed fingerprint to the issuer name (of your choice).

Either new this class programmatically, or assign it ServiceConfiguration - or do it in web.config.

You need to know the fingerprint of the publisher, although to successfully verify the token, ask who sends the token to you.

0
source

Source: https://habr.com/ru/post/1242934/


All Articles