2017-01-31 10 views
0

ここで間違っていることがわかりません。私はアイデンティティサーバー3で働いているほとんどのものを手に入れました。私は初心者だとは思っていませんが、ログアウトのために生成されたリンクを使用した後に、javascriptアプリケーションから選択したリダイレクトURLに自動リダイレクトするのは本当に苦労しています。簡潔にするために省略されているものもあります(full jwtトークンなど)。もちろんIdentityServer3ログアウトエンドポイントで自動リダイレクトしない

var corsPolicy = new DefaultCorsPolicyService 
      { 
       AllowedOrigins = new[] 
       { 
        "https://storageurl.blob.core.windows.net", 
        CloudConfigurationManager.GetSetting("Auth:CorsOriginPrimary"), 
        CloudConfigurationManager.GetSetting("Auth:CorsOriginSecondary") 
       }, 
       AllowAll = true 
      }; 

AllowAll =真:

new Client 
      { 
       ClientName = "Website User", 
       ClientId = "webuser", 
       Flow = Flows.AuthorizationCode, 
       RequireConsent = false, 
       AllowedCorsOrigins = new List<string>() 
       { 
        CloudConfigurationManager.GetSetting("Auth:CorsOriginPrimary"), 
        CloudConfigurationManager.GetSetting("Auth:CorsOriginSecondary"), 
       }, 
       RedirectUris = new List<string> 
       { 
        CloudConfigurationManager.GetSetting("Auth:RedirectUri"), 
        CloudConfigurationManager.GetSetting("Auth:SecondaryRedirectUri"), 
        CloudConfigurationManager.GetSetting("Auth:TertiaryRedirectUri") 
       }, 
       ClientSecrets = new List<Secret> 
       { 
        new Secret(CloudConfigurationManager.GetSetting("WebUser:Secret").Sha256()) 
       }, 
       PostLogoutRedirectUris = new List<string> 
       { 
        CloudConfigurationManager.GetSetting("Auth:WebPostLogoutUri"), 
        CloudConfigurationManager.GetSetting("Auth:WebPostLogoutUri:Local") 
       }, 
       AllowAccessToAllScopes = true 
      }, 

ここでは工場出荷時の設定です(CORS)のもの:ここで

https://identity.mysite.com/id/connect/endsession?id_token_hint=jwt-id-token&post_logout_redirect_uri=http://localhost:3000/ 

は、クライアントの設定である:ここで

は私の要求であります私が実際にそれを働かせようとしているだけでした。ここで

は、関連する設定項目です:

<add key="Auth:RedirectUri" value="http://localhost:3000/_oauth/oidc/" /> 
    <add key="Auth:SecondaryRedirectUri" value="http://mysiteloc.com:3000/_oauth/oidc" /> 
    <add key="Auth:TertiaryRedirectUri" value="http://localhost:3000/_oauth/oidc" /> 
    <add key="Auth:CorsOriginPrimary" value="http://localhost:3000" /> 
    <add key="Auth:CorsOriginSecondary" value="http://mysiteloc.com:3000" /> 
    <add key="Auth:WebPostLogoutUri" value="http://localhost:3000/" /> 
    <add key="Auth:WebPostLogoutUri:Local" value="http://mysiteloc:3000/" /> 

そしてここにログがあります。 CORSに何か問題があるように見えますが、わかりません。私は工場の設定とクライアントの設定で起源を許可することで十分だろうと思っていただろうが、私はまだ問題を得ています。

2017-01-30 16:52:14.2034 INFO: Redirecting to logout page 
2017-01-30 16:52:14.2465 INFO: Logout prompt for subject: 2054e687-777b-4ca3-bb20-ee59d8a1dc28 
2017-01-30 16:52:14.2465 INFO: EnableSignOutPrompt set to false, performing logout 
2017-01-30 16:52:14.2465 INFO: Logout endpoint submitted 
2017-01-30 16:52:14.2465 INFO: Logout requested for subject: 2054e687-777b-4ca3-bb20-ee59d8a1dc28 
2017-01-30 16:52:14.2465 INFO: Clearing cookies 
2017-01-30 16:52:14.2580 INFO: rendering logged out page 
2017-01-30 16:52:14.5831 INFO: CSP Report endpoint requested 
2017-01-30 16:52:14.5831 INFO: CSP Report data: {"csp-report":{"document-uri":"https://identity.mysite.com/id/logout","referrer":"http://localhost:3000/reservations/purchase","violated-directive":"script-src 'self' ","effective-directive":"script-src","original-policy":"default-src 'self'; script-src 'self' ; style-src 'self' 'unsafe-inline' ; img-src *; font-src 'self' https://storageurl.blob.core.windows.net/; report-uri https://identity.mysite.com/id/csp/report","blocked-uri":"eval","line-number":174,"column-number":361,"source-file":"https://identity.mysite.com/id/assets/scripts.2.5.0.js","status-code":0}} 
2017-01-30 16:52:14.5831 INFO: Rendering 204 
2017-01-30 16:52:14.7738 INFO: End session callback requested 
2017-01-30 16:52:14.7738 DEBUG: No client end session iframe URLs 

あなたが私を助けてくれるものは素晴らしいものです。実際のIDトークンの代わりに認証コードを渡す必要があるかもしれないと思っていますが、IDトークンを渡してうまく動作する他の例を見てきました。私は何が欠けていますか?

編集:Chromeのネットワークタブを見ると、元のエンドセッションエンドポイントがendsessioncallback?sid = [some-sort-of-id]にリダイレクトされるようにも見えます。これは正常な動作ですか?

+0

もう1つの考え方 - id_token_hintパラメータを送信するとき、どのタイプのトークンを含める必要がありますか?たとえば、トークンの前に「ベアラ」の指定が必要ですか? – Ryan

+0

いいえ、ちょうどj_tとしてid_token。 –

答えて

0

https://identityserver.github.io/Documentation/docsv2/configuration/authenticationOptions.html

EnablePostSignOutAutoRedirect(デフォルト:false)?

オプションでこのプロパティに触れていない場合は、これが該当する可能性があります。

+0

このプロパティはすでにtrueに設定されていますが、違いはありません。しかし、ありがとう! – Ryan

+0

次に、あなたが体験していることを理解するためにもう少し詳細を提供する必要があります。 どのようにhttps://identity.mysite.com/id/connect/endsessionにリダイレクトしますか? windows.location = yoururl? 新しいタブを開き、id_tokenとurlを手動で入力するだけでエンドセッションURLを手動で入力するとどうなりますか?ログアウト画面がまったく表示されるのですか、それとも失敗しますか? あなたはCORSについて話していたことを考慮すると、間違ったことをしているように聞こえます。 CORSは、リダイレクトの代わりにAJAXコールを行わない限り関連しません。 –

+0

コメントありがとう!今は単にwindow.location = yoururlです。アジャスタ経由でサインアウトするより良い方法があれば、ユーザーはログアウトしたいので、それをしたいと思っています。アイデンティティ・サーバーからフィードバックを得ることは大したことではありません。 – Ryan

関連する問題