Skip to content
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

Enhance the token authentication converter to accept the custom jwt granted authorities converter #32335

Conversation

moarychan
Copy link
Member

Description

Fixes #28665

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@ghost ghost added the azure-spring All azure-spring related issues label Nov 25, 2022
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

spring-cloud-azure-autoconfigure

@moarychan moarychan changed the title Enhance the token authentication converter to accept the custom jwt granted authority converter Enhance the token authentication converter to accept the custom jwt granted authorities converter Nov 29, 2022
@moarychan
Copy link
Member Author

@stliu , please help review the API changes in this PR, thanks~

public AadResourceServerWebSecurityConfigurerAdapter(AadResourceServerProperties properties,
Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthorityConverter) {
this.properties = properties;
this.jwtGrantedAuthorityConverter = jwtGrantedAuthorityConverter;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

converter.setJwtGrantedAuthoritiesConverter(jwtGrantedAuthorityConverter);
} else {
converter.setJwtGrantedAuthoritiesConverter(
new AadJwtGrantedAuthoritiesConverter(properties.getClaimToAuthorityPrefixMap()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a little wired, why this new AadJwtGrantedAuthoritiesConverter(properties.getClaimToAuthorityPrefixMap()) here instead of in the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required a Map to construct the granted authorities converter, the AadJwtGrantedAuthoritiesConverter only accepts a constructor parameter.

@moarychan moarychan enabled auto-merge (squash) December 6, 2022 03:11
@moarychan
Copy link
Member Author

/check-enforcer override

@moarychan moarychan merged commit dc962ce into Azure:main Dec 6, 2022
@moarychan
Copy link
Member Author

Move the design doc to wiki page https://github.com/Azure/azure-sdk-for-java/wiki/Design-for-Enhance-AAD-token-authentication-converter-to-customized-granted-authorities-converter

@moarychan moarychan deleted the moary/support-accept-jwt-granted-authority-converter-4.x branch December 9, 2022 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] AadJwtBearerTokenAuthenticationConverter Change In Public Methods
3 participants