Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just in case want to share my experience, it might help somebody in the future. Well, solution I finally came to looks like this:</p> <pre><code> var message = SignInResponseMessage.CreateFromFormPost(Request) as SignInResponseMessage; var rstr = new WSFederationSerializer().CreateResponse(message, new WSTrustSerializationContext(SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager())); var issuers = new ConfigurationBasedIssuerNameRegistry(); issuers.AddTrustedIssuer("630AF999EA69AF4917362D30C9EEA00C22D9A343", @"http://MyADFSServer/adfs/services/trust"); var tokenHandler = new Saml11SecurityTokenHandler {CertificateValidator = X509CertificateValidator.None}; var config = new SecurityTokenHandlerConfiguration{ CertificateValidator = X509CertificateValidator.None, IssuerNameRegistry = issuers}; config.AudienceRestriction.AllowedAudienceUris.Add(new Uri("MyUri")); tokenHandler.Configuration = config; using(var reader=XmlReader.Create(new StringReader(rstr.RequestedSecurityToken.SecurityTokenXml.OuterXml))) { token = tokenHandler.ReadToken(reader); } ClaimsIdentityCollection claimsIdentity = tokenHandler.ValidateToken(token); </code></pre> <p>I found few similar code that uses SecurityTokenServiceConfiguration (it contains token handlers) instead of Saml11SecurityTokenHandler to read and parse token, however it did not work for me because of certificate validation failure. Setting <code>SecurityTokenServiceConfiguration.CertificateValidator</code> to <code>X509CertificateValidator.None</code> did not help coz Security Token Handler classes uses their own handler configuration and ignores STS configuration values, at least if you specify configuration parameters through the code like I did, however it works fine in case configuration is defined in web.config.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload