Skip to content

Commit

Permalink
add group attributes info (#20733)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiliuTo authored and benbp committed Apr 28, 2021
1 parent f4f71ce commit ad6cae9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,19 @@ In order to try the authorization action with this sample with minimum effort, [
## Advanced features

### Support access control by id token in web application
If you want to use `id_token` for authorization, we can use `appRoles` feature of AAD to generate id_token's `roles` claim and then create `GrantedAuthority` from `roles` to implement access control.
Note the `roles` claim generated from `appRoles` is decorated with prefix `APPROLE_`.
If you want to use `id_token` for authorization, the `appRoles` feature of AAD is supported which is presented in id_token's `roles` claim. By following below configurations, `GrantedAuthority` can be generated from `roles` claim.

Note:
- The `roles` claim generated from `appRoles` is decorated with prefix `APPROLE_`.
- When using `appRoles` as `roles` claim, please avoid configuring group attribute as `roles` at the same time. The latter will override the claim to contain group information instead of `appRoles`. Below configuration in manifest should be avoided:
```
"optionalClaims": {
"idtoken": [{
"name": "groups",
"additionalProperties": ["emit_as_roles"]
}]
}
```
Follow the guide to
[add app roles in your application](https://docs.microsoft.com/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps).
Expand Down
14 changes: 13 additions & 1 deletion sdk/spring/azure-spring-boot-starter-active-directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,19 @@ Here are some examples about how to use these properties:
#### Support access control by id token in web application

This starter supports creating `GrantedAuthority` from id_token's `roles` claim to allow using `id_token` for authorization in web application. Developers can use the
`appRoles` feature of Azure Active Directory to create `roles` claim and implement access control. Note the `roles` claim generated from `appRoles` is decorated with prefix `APPROLE_`.
`appRoles` feature of Azure Active Directory to create `roles` claim and implement access control.

Note:
- The `roles` claim generated from `appRoles` is decorated with prefix `APPROLE_`.
- When using `appRoles` as `roles` claim, please avoid configuring group attribute as `roles` at the same time. The latter will override the claim to contain group information instead of `appRoles`. Below configuration in manifest should be avoided:
```
"optionalClaims": {
"idtoken": [{
"name": "groups",
"additionalProperties": ["emit_as_roles"]
}]
}
```

Follow the guide to [add app roles in your application and assign to users or groups](https://docs.microsoft.com/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps).

Expand Down

0 comments on commit ad6cae9

Please sign in to comment.