Google은 일반 OpenID Connect 미들웨어를 사용하여 Google을 IdentityServer3을 사용하는 외부 ID 공급자로 사용하고 있습니다. 우리는 MetadataAddress 또는 특별한 TokenValidationParameters를 설정하지 않습니다 (그래서 Authority를 기반으로하는 메타 데이터를 얻은 다음이를 기반으로 매개 변수를 채워야합니다). 다음 오류가 간헐적으로 발생합니다. 나는이 오류가 잘못된 사용자 지정 유효성 검사를 포함하는 것으로 보였고 간헐적이지는 않습니다.OWIN의 SecurityTokenSignatureKeyNotFoundException Google에 연결하는 OpenID Connect 미들웨어
Authentication Failed : Microsoft.IdentityModel.Protocols.OpenIdConnectMessage : System.IdentityModel.Tokens.SecurityTokenSignatureKeyNotFoundException : IDX10500 : Signature validation failed.Unable to resolve SecurityKeyIdentifier : 'SecurityKeyIdentifier
(
IsReadOnly = False,
Count = 1,
Clause[0] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause
)
',
token : '{"alg":"RS256","kid":"74e0db263dbc69ac75d8bf0853a15d05e04be1a2"}.{"iss":"https://accounts.google.com","iat":1484922455,"exp":1484926055, <snip more claims>}'.
at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)in c : \ workspace \ WilsonForDotNet45Release \ src \ System.IdentityModel.Tokens.Jwt \ JwtSecurityTokenHandler.cs : line 943
at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken & validatedToken)in c : \ workspace \ WilsonForDotNet45Release \ src \ System.IdentityModel.Tokens.Jwt \ JwtSecurityTokenHandler.cs : line 671
at Microsoft.IdentityModel.Extensions.SecurityTokenHandlerCollectionExtensions.ValidateToken(SecurityTokenHandlerCollection tokenHandlers, String securityToken, TokenValidationParameters validationParameters, SecurityToken & validatedToken)in c : \ workspace \ WilsonForDotNet45Release \ src \ Microsoft.IdentityModel.Protocol.Extensions \ SecurityTokenHandlerCollectionExtensions.cs : line 71
at Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationHandler. <AuthenticateCoreAsync> d__1a.MoveNext()
kid
는 https://www.googleapis.com/oauth2/v3/certs에서 3 현재 키 2이다 칭함.
우리의 옵션은 다음과 같이 :
var options = new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "Google",
Caption = "Sign in with Google",
Scope = "openid email profile",
ClientId = clientId,
Authority = "https://accounts.google.com/",
AuthenticationMode = AuthenticationMode.Passive,
RedirectUri = new Uri(baseUri, "identity/signin-google").ToString(),
Notifications = new OpenIdConnectAuthenticationNotifications()
{
AuthenticationFailed = context => HandleException(context),
RedirectToIdentityProvider = context => AddLoginHint(context),
},
SignInAsAuthenticationType = signInAsType
};
app.UseOpenIdConnectAuthentication(options);
이이 구성 문제 또는과 (와 방법 그렇다면) 처리 될 필요가 일시적인 오류의 일종인가? 최종 고객은 한 번 재 시도를하고 있지만 (나는 기다리고 있다고 생각하지 않지만) 도움이되지는 않습니다.