最近のアクセス:
GAM を使用して Azure Active Directory に対して認証を行う方法

このチュートリアルでは、GAM を使用して Azure Active Directory でユーザーを認証する方法を説明します。
基本的には、OAuth 2.0 認証タイプを使用して、Azure Portal と GAM Backend の両方で、いくつかの設定を行う必要があります。

Azure Portal での設定

1.アプリケーションを定義して登録します。Microsoft のこちらのガイドを参照してください。
2.アプリケーション ID を取得します (後に必要):
イメージ:48910.png
3.リダイレクト URI を設定します。 [ Authentication ] メニューオプション (面左側のパネル) に移動し、新しい Web プラットフォームを作成します。それから、フォーム内のリダイレクト URI を追加します:
http://<server>:<port>/<BackendBaseURL>/oauth/gam/callback   
イメージ:48911.png
4. [ Certificates and secrets ] に移動し、新しいシークレットを作成します。シークレットのをコピーします (後に必要)。
イメージ:48912.png
5. [ API permissions ] で、Microsoft Graph の User.Read を追加したことを確認します:
イメージ:48913.png

GAM Backend での設定

以下の 2 つの設定オプションがあります:
1.新しい OAuth 2.0 認証タイプを作成し、次の基本情報を定義します: 名前、デスクリプション、画像 (オプション) など。
2. [ General ] タブで、次を定義します:
イメージ:52243.jpg
リダイレクト URL の形式は次のとおりです:
http://<server>:<port>/<BackendBaseURL>/
: 次のタブの設定を行うには、Azure でアプリケーションのエンドポイントを確認する必要があります。
イメージ:48915.png
3. [ Authorization ] タブ:
URL: 
https://login.microsoftonline.com/{tenat}/oauth2/v2.0/authorize        
Response type TAG:  response_type      Value: code
Scope TAG:          scope              Value: https://graph.microsoft.com/user.read
State TAG:          state
Include ClientID and RedirectURL
Response:
Access code TAG: code
Error description TAG: error_description
URL に Azure Active Directory 内のテナントの指定が含まれます。
4. [ Token ] タブ:
URL: https://login.microsoftonline.com/{tenat}/oauth2/v2.0/token
Header Content type: Content-type      Value: application/x-www-form-urlencoded
Grant type:         grant_type        Value: authorization_code
Include = All
Response:
Access token TAG: access_token
Token type TAG: token_type
Expires in TAG: expires_in
Scope TAG: scope
Error description TAG: error_description
Validate external token = False
5. [ User Information ] タブ:
URL:  https://graph.microsoft.com/v1.0/me
Method: Get
Header Content type: Content-type      Value: application/json;charset=utf-8
Do not include anything
Email TAG: mail
External ID TAG: id
Name TAG:  userPrincipalName
First name TAG: givenName
Last name TAG: surname
Error description TAG: message

注:
  • [ User Information ] タブでは、上記の設定で指定していないフィールドはすべて空のままにしておきます。
    例: 次のエラーを解決する場合: コード: 284、メッセージ:「azuread account is not verified, first verify your azuread account.」
    フィールド [ User Verified Email Tag ] が空になっているかどうかを確認します。
 
  • Azure Active Directory へのログインは、Azure Portal ではなく、ご使用のアプリケーションでユーザーの資格情報を入力して実行できます。
    そのためには、 [ Redirect to authenticate? ] を無効にします。
    エラー GAM 280 AADSTS900144 の場合: リクエスト本体に次のパラメーターが含まれている必要があります: 'scope'。SAC 51934 を参照してください。
イメージ:52244.jpg


サブページ
Created: 24/03/25 23:57 by Admin Last update: 24/03/25 23:57 by Admin
カテゴリ
Powered by GXwiki 3.0