Azure / Azure/static-web-apps

[QUESTION] How to take custom roles on UI with custom auth by AAD?

Open
#525 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm using SWA with custom auth by AAD. AAD configured to have custom appRoles for the users.

`"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/278XXXX27/v2.0",
"clientId": "a5eXXXX5ca",
"clientSecretSettingName": "ClientSecretSetting"
}
}
}`

Wasn't able to configure custom user attribute "userRoles" to have roles like they are supported in OOTB SWA auth approach.
So after succesfull login .auth/me returns only standart predefined userRoles for any account
`"userRoles": [
"authenticated",
"anonymous"
]`

After succesfull login I retrieve id_token in request to ... /auth/login/aad/callback

![image](https://user-images.githubusercontent.com/3428505/127160477-cafbd9c0-9db3-4352-af67-857fe7d286b8.png)

AAD has several custom Roles which can be encoded from the id_token like this:
`
"roles": [
"Admin",
"AppUser"
],`

How to set up AD to support userRoles in SWA style?
Or are there any way to catch id_token in JS code for further encoding to get appRoles?

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.