2016-11-28 12 views
0

私はOpenIdConnectとReply URL WebサイトでAzure ADを使用していますが、テストのためにLocalHostで接続し、他の機能を実装する必要があります。OpenIDConnectを使用したAzure ADアプリケーションの返信URL

UseOpenIdConnectAuthenticationを使用し、両方でアクセスを失うことなく、複数の返信URLを持つ方法を教えてください。

私のアプリケーションはAsp.Net Web.Forms(Visual Studio 2015)で設定されています。

Tks。

Vilela

答えて

0

はい、それは作品だが、私は他の人のコードを実装する必要、例えば:私は、マルチテナントに問題があるんだ、

RedirectToIdentityProvider = (context) => 
        { 
         // This ensures that the address used for sign in and sign out is picked up dynamically from the request 
         // this allows you to deploy your app (to Azure Web Sites, for example)without having to change settings 
         // Remember that the base URL of the address used here must be provisioned in Azure AD beforehand. 
         string appBaseUrl = context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase; 
         context.ProtocolMessage.RedirectUri = appBaseUrl; 
         context.ProtocolMessage.PostLogoutRedirectUri = appBaseUrl; 
         return System.Threading.Tasks.Task.FromResult(0); 
        }, 

しかし。他のユーザーは私のテナントの認証です。それは私の問題かAzureの問題ですか?これが意味するだろう何

TKS、 Vilela

1

はい、それはdynamiclly RedirectToIdentityProviderを使用して返信URLを変更することが可能です。アプリケーションがすでにWebサーバーにデプロイされた場合

app.UseOpenIdConnectAuthentication(
      new OpenIdConnectAuthenticationOptions 
      { 
       ClientId = clientId, 
       Authority = authority, 
       PostLogoutRedirectUri = postLogoutRedirectUri, 
       RedirectUri = postLogoutRedirectUri, 
       Notifications = new OpenIdConnectAuthenticationNotifications 
       { 
        AuthenticationFailed = context => 
        { 
         context.HandleResponse(); 
         context.Response.Redirect("/Error?message=" + context.Exception.Message); 
         return Task.FromResult(0); 
        }, 
        RedirectToIdentityProvider=(context)=> 
        { 
         context.ProtocolMessage.RedirectUri = ""; 
         return Task.FromResult(0); 
        } 
       } 
      }); 

しかし、あなたがウェブ用の2台の異なるアプリケーション・サーバがあるので、期待通りに動作しない場合がありますlocalhostにリダイレクトURLを変更します。あなたは、以下のサンプルコードを参照することができますアプリが実行中です。

+0

は、あなたがリクエストURIに手動でリダイレクトURIを設定するだろうということですか?唯一の方法のようですね。 – juunas

+0

帰っていただきありがとうございますが、Azure ADのリダイレクトURLを変更する理由はわかりません。自動ではありませんか? – Vilela

+0

Azureポータルのアプリケーション用に登録したリダイレクトURLと、リクエストで渡したリダイレクトURLとは異なります。 Azure広告は、渡されたリダイレクトURLをポータルのバリューレジスタに基づいて検証します。値が確認された場合、Azure ADはこのURLをクライアントに返します。問題が解決しない場合は、お気軽にお電話ください。 –

関連する問題