-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For AAD resource-server, create grantedAuthority by both "roles" and "claims" by default. #19412
For AAD resource-server, create grantedAuthority by both "roles" and "claims" by default. #19412
Conversation
…"claims" by default.
for (String claimName : WELL_KNOWN_AUTHORITIES_CLAIM_NAMES) { | ||
if (jwt.containsClaim(claimName)) { | ||
Object authorities = jwt.getClaim(claimName); | ||
if (authorities instanceof String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about
if ( jwt.getClaim(claimName) instanceof String)
* Simplify the code, remove unnecessary variables.
* Update unit tests.
* Remove setJwtGrantedAuthoritiesConverter method.
…claims_by_default
…edAuthoritiesConverter` method.
.../src/test/java/com/azure/spring/aad/webapi/AADJwtBearerTokenAuthenticationConverterTest.java
Show resolved
Hide resolved
.../src/test/java/com/azure/spring/aad/webapi/AADJwtBearerTokenAuthenticationConverterTest.java
Show resolved
Hide resolved
when(jwt.containsClaim("roles")).thenReturn(true); | ||
AADJwtBearerTokenAuthenticationConverter converter = new AADJwtBearerTokenAuthenticationConverter("roles", "ROLE_"); | ||
AADJwtBearerTokenAuthenticationConverter converter = new AADJwtBearerTokenAuthenticationConverter("roles", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use roles + "APPROLE_" as a default, maybe we should use another combination here.
/azp run java - spring - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
IT failed for |
/check-enforcer override |
Hi just wondering why you chose The affect of this is that you now MUST use From https://www.baeldung.com/spring-security-expressions
|
ok no bigggie so i worked out we can pass our own converter in AADResourceServerWebSecurityConfigurerAdapter like this |
For AAD resource-server, create grantedAuthority by both "roles" and "claims" by default.