This project has moved. For the latest updates, please go here.

WSFederation Error

Sep 5, 2014 at 9:05 PM
I've just upgraded to version 3.0.0 of the WSFederation middleware and the first error I received was that WsFederationAuthenticationOptions does not contain a definition for 'IssuerAddress'
If I change
IssuerAddress = "https://EndpointURL" 
to
Configuration = new Microsoft.IdentityModel.Protocols.WsFederationConfiguration()
                {
                    TokenEndpoint = "https://EndpointURL"
                }
then it seems to go to the SignOn server as before. Once redirected back however, I seem to get an error to do with the signing tokens (See error below)
I was setting this information via WsFederationAuthenticationOptions.TokenValidationParameters
I.E
TokenValidationParameters = new System.IdentityModel.Tokens.TokenValidationParameters()
                {
                    ValidAudience = "AudienceName",
                    ValidIssuer = "IssuerName",
                    IssuerSigningTokens = new List<SecurityToken>{
                        new X509SecurityToken(issuerSigningCertificate)
                    }
                }
This used to work perfectly but now I get the following error. Where should I be setting the Signing Certificate details and also Encryption Certificate details?
Many Thanks
[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.IdentityModel.Tokens.SecurityKeyResolver.ResolvesToSigningToken(SecurityKeyIdentifierClause keyIdentifierClause, SecurityKey& key, SecurityToken& token) +1375
Microsoft.IdentityModel.Tokens.SecurityKeyResolver.TryResolveSecurityKeyCore(SecurityKeyIdentifierClause keyIdentifierClause, SecurityKey& key) +57
System.IdentityModel.Selectors.SecurityTokenResolver.TryResolveSecurityKey(SecurityKeyIdentifierClause keyIdentifierClause, SecurityKey& key) +22
System.IdentityModel.EnvelopedSignatureReader.ResolveSigningCredentials() +129
System.IdentityModel.EnvelopedSignatureReader.OnEndOfRootElement() +41
System.IdentityModel.EnvelopedSignatureReader.Read() +73
System.Xml.XmlReader.ReadEndElement() +37
System.IdentityModel.Tokens.SamlSecurityTokenHandler.ReadAssertion(XmlReader reader) +759
System.IdentityModel.Tokens.SamlSecurityTokenHandler.ReadToken(XmlReader reader) +43
Microsoft.IdentityModel.Tokens.SamlSecurityTokenHandler.ReadToken(XmlReader reader, TokenValidationParameters validationParameters) +227
Microsoft.IdentityModel.Tokens.SamlSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken) +904
Microsoft.IdentityModel.Extensions.SecurityTokenHandlerCollectionExtensions.ValidateToken(SecurityTokenHandlerCollection tokenHandlers, String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken) +365
Microsoft.Owin.Security.WsFederation.<AuthenticateCoreAsync>d__1f.MoveNext() +4391
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22
Microsoft.Owin.Security.WsFederation.<AuthenticateCoreAsync>d__1f.MoveNext() +7062
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
Microsoft.Owin.Security.Infrastructure.<BaseInitializeAsync>d__0.MoveNext() +810
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
Microsoft.Owin.Security.Infrastructure.<Invoke>d__0.MoveNext() +427
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__5.MoveNext() +287
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
Microsoft.Owin.Security.Infrastructure.<Invoke>d__0.MoveNext() +937
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<RunApp>d__5.MoveNext() +287
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.<DoFinalWork>d__2.MoveNext() +272
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22
Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() +33
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +150
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +42
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +415
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Coordinator
Sep 5, 2014 at 9:31 PM
Have you tried TVP.IssuerSigningKeys instead of IssuerSigningTokens?
Sep 6, 2014 at 1:02 AM
Edited Sep 6, 2014 at 1:42 AM
Thank Tratcher,
Things are back to normal after following your suggestion.
Do you know where I would set the certificate to enable decryption of a response?