Note that there are some explanatory texts on larger screens.

plurals
  1. POConfiguring ASP.NET MVC 4 to work with Azure's ACS and Microsoft's new System.IdentityModel.Tokens.Jwt Library
    primarykey
    data
    text
    <p>How do you integrate version 1.0.0 of the new JWT handler library (System.IdentityModel.Tokens.Jwt) into a ASP.NET MVC 4 application to process the Azure's JWT token from ACS? </p> <p>I'm receiving the following error when I try to run my application:</p> <blockquote> <p>[SecurityTokenValidationException: Jwt10329: Unable to validate signature, Configuration.IssuerTokenResolver.ResolveToken returned null. jwt.Header.SigningKeyIdentifier: 'SecurityKeyIdentifier ( IsReadOnly = False, Count = 2, Clause[0] = X509ThumbprintKeyIdentifierClause(Hash = 0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX), Clause[1] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause ) '.] System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateSignature(JwtSecurityToken jwt) +1275<br> System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(JwtSecurityToken jwt) +113<br> System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(SecurityToken token) +339<br> System.IdentityModel.Tokens.SecurityTokenHandlerCollection.ValidateToken(SecurityToken token) +73<br> System.IdentityModel.Services.TokenReceiver.AuthenticateToken(SecurityToken token, Boolean ensureBearerToken, String endpointUri) +120<br> System.IdentityModel.Services.WSFederationAuthenticationModule.SignInWithResponseMessage(HttpRequestBase request) +493<br> System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs args) +364<br> System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +69</p> </blockquote> <p>My web.config is configured as such:</p> <pre><code>&lt;system.identityModel&gt; &lt;identityConfiguration&gt; &lt;audienceUris&gt; &lt;add value="http://127.0.0.1:81/" /&gt; &lt;/audienceUris&gt; &lt;issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt; &lt;trustedIssuers&gt; &lt;add thumbprint="PRIVATEKEY" name="https://CUSTOM.accesscontrol.windows.net/" /&gt; &lt;/trustedIssuers&gt; &lt;/issuerNameRegistry&gt; &lt;securityTokenHandlers&gt; &lt;add type="System.IdentityModel.Tokens.JwtSecurityTokenHandler, System.IdentityModel.Tokens.Jwt" /&gt; &lt;securityTokenHandlerConfiguration&gt; &lt;certificateValidation certificateValidationMode="PeerTrust" /&gt; &lt;/securityTokenHandlerConfiguration&gt; &lt;add type="System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt; &lt;remove type="System.IdentityModel.Tokens.SessionSecurityTokenHandler, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt; &lt;/securityTokenHandlers&gt; &lt;/identityConfiguration&gt; &lt;/system.identityModel&gt; &lt;system.identityModel.services&gt; &lt;federationConfiguration&gt; &lt;cookieHandler requireSsl="false" /&gt; &lt;wsFederation passiveRedirectEnabled="false" issuer="https://staging.accesscontrol.windows.net/v2/wsfederation" realm="http://127.0.0.1:81/" requireHttps="false" /&gt; &lt;/federationConfiguration&gt; &lt;/system.identityModel.services&gt; </code></pre> <p>I have setup Azure ACS to return a JWT token and have set the correct security thumbnail in the web.config, but I am stumped why this error is happening. Any insights?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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