0

Azure ADからDotNetOpenAuthライブラリ経由で認証トークンを取得しようとしています。私は巨大なプロジェクトが.net 3.5であり、ADALは.net 3.5(唯一の.net> 4)をサポートしていないため、ADALを使用したくありません。しかし、私はAzure ADでうまく動作させることができません。私は何を設定するのか分からない。これまでのところ、これは私が持っているものです:Azure ADからDotnetopenauthで許可トークンを取得する

private static WebServerClient _webServerClient; 
    private static string _accessToken; 
    // Client ID (as obtained from Azure AD portal) 
    private static string clientId = "here goes my client id guid"; 
    // Client Secret (as obtained from Azure AD portal) 
    private static string appKey = "here goes my secret"; 
    private static string aadInstance = "https://login.microsoftonline.com/{0}"; 
    private static string tenant = "mytenant.domain.com"; 
    private static string authority = string.Format(CultureInfo.InvariantCulture, aadInstance, tenant); 
    // Azure AD resource I am trying to access 
    private static string serviceResourceId = "https://mytenant.domain.com/protectedresource"; 


    private static void InitializeWebServerClient() 
    { 
     var authorizationServer = new AuthorizationServerDescription 
     { 
      AuthorizationEndpoint = new Uri(""/* WHAT TO PUT HERE */), 
      TokenEndpoint = new Uri(""/* WHAT TO PUT HERE */) 
     }; 
     _webServerClient = new WebServerClient(authorizationServer, clientId, appKey); 
    } 



    private static void RequestToken() 
    { 
     var state = _webServerClient.GetClientAccessToken(); 
     _accessToken = state.AccessToken; 
    } 

    static void Main(string[] args) { 
     InitializeWebServerClient(); 
     RequestToken(); 
    } 

私はここに何を置くべきかわかりません。

AuthorizationEndpoint =新しいウリ( "" /* HERE */を置くためにWHAT)、

TokenEndpoint =新しいウリを( "" /* WHAT TO:私はここに置くべき値がわかりませんPUT HERE */

答えて

0

これを確認してくださいGitHubサンプルは、認証に役立ちます。詳細な指示で認証トークンを認証および取得する3つの方法があります。必要なものの詳細については、app.configでサンプル値とメソッドコメントを確認してください。サンプルへ

リンク:サンプルのためAzure Authentication GitHub Sample

関連ブログ:{tenantId}は、あなたのテナントのGUID識別子です

https://login.windows.net/{{tenantId}}/oauth2/authorize 
https://login.windows.net/{tenantId}/oauth2/token 

Azure Authentication - Authenticating any Azure API Request in your Application

0

私はあなたがしたい2つのエンドポイントであると考えています。あなたのドメインでも動作するかもしれませんが、私はそれをチェックしていません。

関連する問題