前言
最近同仁透過 CAS 接 Azure OIDC ,當同仁登入 Azure 後,Azure 傳給 CAS 的 Claims 只有預設的那些。
但是在 Azure User 的屬性中有一個mailnickname,我們想要把這個屬性當作額外的 Claim 傳給 CAS。
這樣要怎麼設定呢?
做法
一般在設定時,一定會在 Microsoft Entra ID(舊 Azure AD) 中的 App registrations 建立 App(Supported account types 為 Single tenant),
它同時也會在 Enterprise applications 建立該 App。
1.在 App registrations 中的 App 設定 Manifest 中的 acceptMappedClaims
在 App registrations 中選到建立的 App ,點選 Manifest ,將 acceptMappedClaims 設定為 true。accessTokenAcceptedVersion 預設值為 null ,也就是 v1.0 id_tokens 的版本,如果需要 v2.0 ,就將它改成 2。
詳細設定請參考: Microsoft Entra 應用程式資訊清單
2.在 Enterprise applications 中的 App 的 Single sing-on 中增加 Claims
在 Enterprise applications 中選到建立的 App,點選 Single sing-on 在 2 Atrributes & Claims 按下 Edit
在Atrributes & Claims功能中,按下+ Add new claim,
填入 name 並選擇 Source attribute 為 user.mailnickname (請依需求調整),最後按下 Save
設定完成後,在 CAS 那透過 Azrue OIDC 登入後,就可以多取到一個叫 mailnickname 的 Claim 了哦~
- 註:如果 CAS 出現
This application is required to be configured with an application-specific signing key. It is either not configured with one, or the key has expired or is not yet valid.表示沒設定 Manifest
參考資源
App Registrations vs Enterprise Applications in Azure AD - Certificate Significance
Difference between “enterprise application” and “app registration” in Azure
Microsoft Entra 應用程式資訊清單
When using a custom Azure ClaimsMappingPolicy can’t sign in “This application is required to be configured with an application-specific signing key. “