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

OAuth2ResourceServer configuration tests use deprecated extractAuthorities #6516

Closed
jzheaux opened this issue Feb 8, 2019 · 11 comments
Closed
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Feb 8, 2019

JwtAuthenticationConverter#extractAuthorities was deprecated in #6273 via 0f7dff3.

OAuth2ResourceServerConfigurerTests and OAuth2ResourceServerSpecTests should be updated to no longer use it, changing instead to use setJwtGrantedAuthoritiesConverter.

@jzheaux jzheaux added type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: first-timers-only An issue that can only be worked on by brand new contributors labels Feb 8, 2019
@vishalvrv9
Copy link
Contributor

Hey @jzheaux, haven't completely analyzed the issue but would like to work on it. Can I take this up?

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 8, 2019

Yep, it's yours! Feel free to ping me with any questions.

When you are ready to push, check out the contribution guidelines.

@jzheaux jzheaux removed the status: first-timers-only An issue that can only be worked on by brand new contributors label Feb 8, 2019
@jzheaux jzheaux self-assigned this Feb 8, 2019
@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 19, 2019

@vishalvrv9 wanted to check in to see how things are going. Are there any questions I can answer for you?

@vishalvrv9
Copy link
Contributor

Hey @jzheaux ,
firstly, apologies for the delay

As per analysis,

  • In OAuth2ResourceServerSpecTests, since the method signature is different from extractAuthorities

what should the implementation changes look like? Can you provide me a starting point as after trying to implement the setJwtGrantedAuthoritiesConverter I am a little lost

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 28, 2019

@vishalvrv9 no problem, my apologies for lagging in my response :)

Something like this might work well:

- JwtAuthenticationConverter converter = new JwtAuthenticationConverter() {
-				@Override
-				protected Collection<GrantedAuthority> extractAuthorities(Jwt jwt) {
-					String[] claims = ((String) jwt.getClaims().get("scope")).split(" ");
-					return Stream.of(claims).map(SimpleGrantedAuthority::new).collect(Collectors.toList());
-				}
-			};
+ JwtAuthenticationConverter converter = new JwtAuthenticationConverter();
+ converter.setJwtGrantedAuthoritiesConverter(jwt -> {
+ 		String[] claims = ((String) jwt.getClaims().get("scope")).split(" ");
+		return Stream.of(claims).map(SimpleGrantedAuthority::new).collect(Collectors.toList());
+ });

@jzheaux
Copy link
Contributor Author

jzheaux commented May 14, 2019

@vishalvrv9 Is this something that you'd still like to work on?

@vishalvrv9
Copy link
Contributor

Hey @jzheaux, Yeah definitely. Apologies lost track of it. Will try submitting a PR as soon as possible.

@vishalvrv9
Copy link
Contributor

@jzheaux have submitted PR #6904

@jzheaux
Copy link
Contributor Author

jzheaux commented May 31, 2019

Thanks, @vishalvrv9! I left a bit of feedback in the PR.

@vishalvrv9
Copy link
Contributor

Hey @jzheaux , worked on the feedback a couple of days back.

@jzheaux
Copy link
Contributor Author

jzheaux commented Jun 12, 2019

Fixed via b6e8997

@jzheaux jzheaux closed this as completed Jun 12, 2019
@rwinch rwinch added this to the 5.2.0.M3 milestone Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants