2016-07-26 3 views
2

私は、ASP.Netコアアプリケーション用のUseOpenIdConnectAuthenticationミドルウェアを使用して、Dellのクラウドアクセスマネージャートークンプロバイダー(OpenId/OAuth2認証を提供するためのセットアップ)に対して認証しています。コードは次のとおりです。OpenIdConnectAuthenticationHandler:message.Stateがnullまたは空です

 app.UseCookieAuthentication(new CookieAuthenticationOptions 
     { 
      AutomaticAuthenticate = true, 
      AutomaticChallenge = true, 
      AuthenticationScheme = "ClientCookie", 
      CookieName = CookieAuthenticationDefaults.CookiePrefix + "ClientCookie", 
      ExpireTimeSpan = TimeSpan.FromMinutes(5), 
      LoginPath = new PathString("/signin"), 
      LogoutPath = new PathString("/signout") 
     }); 

     app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions 
     { 
      RequireHttpsMetadata = false, 
      SaveTokens = true, 
      ClientId = "XYZClient_Id", 
      ClientSecret = "XYZ_ClientSecret", 
      ResponseType = OpenIdConnectResponseType.Code, 
      PostLogoutRedirectUri = "https://example.com", 
      Configuration = new OpenIdConnectConfiguration { 
       AuthorizationEndpoint = "https://CAM.COM/CloudAccessManager/RPSTS/OAuth2/Default.aspx", 
       TokenEndpoint = "https://CAM.COM/CloudAccessManager/RPSTS/OAuth2/Token.aspx", 
       UserInfoEndpoint = "https://CAM.COM/CloudAccessManager/RPSTS/OAuth2/User.aspx", 
       Issuer= "urn:CAM.COM/CloudAccessManager/RPSTS", 
      } 
     }); 

しかし、今は数時間、1つのポイントで固まっています。次のエラーが表示されます。

SecurityTokenInvalidSignatureException:IDX10500:署名の検証に失敗しました。私は指導の任意のタイプは高く評価され https://example.com/signin-oidc?code=somecode&state=somestate

をクエリ文字列バックURL内のコードと状態を取得しています署名

を検証するために使用するためにはセキュリティキーがありません。


UPDATE 追加発行者の署名キー:

TokenValidationParameters = new TokenValidationParameters 
       { 
        IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration.GetValue<string>("AppSettings:ClientSecret"))) 
       } 

答えて

3

あなたはOIDCミドルウェアが提供するOpenID Connect provider configuration discovery featureを使用していないという事実に起因している見ているエラー、それは取得することができますアイデンティティトークンに署名するために使用される暗号鍵。

プロバイダがこの機能をサポートしている場合は、Configurationノード全体を削除し、代わりにAuthorityを設定します。すべてのエンドポイントが自動的に登録されます。

この機能がサポートされていない場合は、OpenIdConnectOptions.TokenValidationParameters.IssuerSigningKeysに手動で署名キーを追加する必要があります。

+0

これは多くの時間を節約し、プロバイダがコンフィグレーションディスカバリエンドポイントを提供しないため、署名キーを手動で追加することから始められます。また、即時返信のためにありがとう – CodeZero

+0

答えが役に立つなら、それをupvote /受け入れられるとマークしてください;) – Pinpoint

関連する問題