Browse Source

Remove deprecations in JwtAuthenticationConverter

Closes gh-11587
pull/11599/head
Joe Grandja 3 years ago
parent
commit
65db5fa028
  1. 18
      oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java

18
oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,26 +40,12 @@ public class JwtAuthenticationConverter implements Converter<Jwt, AbstractAuthen @@ -40,26 +40,12 @@ public class JwtAuthenticationConverter implements Converter<Jwt, AbstractAuthen
@Override
public final AbstractAuthenticationToken convert(Jwt jwt) {
Collection<GrantedAuthority> authorities = extractAuthorities(jwt);
Collection<GrantedAuthority> authorities = this.jwtGrantedAuthoritiesConverter.convert(jwt);
String principalClaimValue = jwt.getClaimAsString(this.principalClaimName);
return new JwtAuthenticationToken(jwt, authorities, principalClaimValue);
}
/**
* Extracts the {@link GrantedAuthority}s from scope attributes typically found in a
* {@link Jwt}
* @param jwt The token
* @return The collection of {@link GrantedAuthority}s found on the token
* @deprecated Since 5.2. Use your own custom converter instead
* @see JwtGrantedAuthoritiesConverter
* @see #setJwtGrantedAuthoritiesConverter(Converter)
*/
@Deprecated
protected Collection<GrantedAuthority> extractAuthorities(Jwt jwt) {
return this.jwtGrantedAuthoritiesConverter.convert(jwt);
}
/**
* Sets the {@link Converter Converter&lt;Jwt, Collection&lt;GrantedAuthority&gt;&gt;}
* to use. Defaults to {@link JwtGrantedAuthoritiesConverter}.

Loading…
Cancel
Save