Fixed final field warnings in opaque token introspectors
This commit is contained in:
parent
729418ad7a
commit
e9d5bbba34
|
@ -61,14 +61,14 @@ import org.springframework.web.client.RestTemplate;
|
|||
*/
|
||||
public class NimbusOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
|
||||
|
||||
private static final String AUTHORITY_PREFIX = "SCOPE_";
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final RestOperations restOperations;
|
||||
|
||||
private Converter<String, RequestEntity<?>> requestEntityConverter;
|
||||
|
||||
private RestOperations restOperations;
|
||||
|
||||
private final String authorityPrefix = "SCOPE_";
|
||||
|
||||
/**
|
||||
* Creates a {@code OpaqueTokenAuthenticationProvider} with the provided parameters
|
||||
* @param introspectionUri The introspection endpoint uri
|
||||
|
@ -258,7 +258,7 @@ public class NimbusOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
|
|||
List<String> scopes = Collections.unmodifiableList(response.getScope().toStringList());
|
||||
claims.put(OAuth2TokenIntrospectionClaimNames.SCOPE, scopes);
|
||||
for (String scope : scopes) {
|
||||
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
|
||||
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
|
||||
}
|
||||
}
|
||||
return new OAuth2IntrospectionAuthenticatedPrincipal(claims, authorities);
|
||||
|
|
|
@ -57,14 +57,14 @@ import org.springframework.web.reactive.function.client.WebClient;
|
|||
*/
|
||||
public class NimbusReactiveOpaqueTokenIntrospector implements ReactiveOpaqueTokenIntrospector {
|
||||
|
||||
private static final String AUTHORITY_PREFIX = "SCOPE_";
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final URI introspectionUri;
|
||||
|
||||
private final WebClient webClient;
|
||||
|
||||
private String authorityPrefix = "SCOPE_";
|
||||
|
||||
/**
|
||||
* Creates a {@code OpaqueTokenReactiveAuthenticationManager} with the provided
|
||||
* parameters
|
||||
|
@ -227,7 +227,7 @@ public class NimbusReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke
|
|||
claims.put(OAuth2TokenIntrospectionClaimNames.SCOPE, scopes);
|
||||
|
||||
for (String scope : scopes) {
|
||||
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
|
||||
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
|
||||
}
|
||||
}
|
||||
return new OAuth2IntrospectionAuthenticatedPrincipal(claims, authorities);
|
||||
|
|
|
@ -57,17 +57,17 @@ import org.springframework.web.client.RestTemplate;
|
|||
*/
|
||||
public class SpringOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
private static final String AUTHORITY_PREFIX = "SCOPE_";
|
||||
|
||||
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
|
||||
};
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final RestOperations restOperations;
|
||||
|
||||
private Converter<String, RequestEntity<?>> requestEntityConverter;
|
||||
|
||||
private RestOperations restOperations;
|
||||
|
||||
private final String authorityPrefix = "SCOPE_";
|
||||
|
||||
/**
|
||||
* Creates a {@code OpaqueTokenAuthenticationProvider} with the provided parameters
|
||||
* @param introspectionUri The introspection endpoint uri
|
||||
|
@ -216,7 +216,7 @@ public class SpringOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
|
|||
if (v instanceof String) {
|
||||
Collection<String> scopes = Arrays.asList(((String) v).split(" "));
|
||||
for (String scope : scopes) {
|
||||
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
|
||||
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
|
||||
}
|
||||
return scopes;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ import org.springframework.web.reactive.function.client.WebClient;
|
|||
*/
|
||||
public class SpringReactiveOpaqueTokenIntrospector implements ReactiveOpaqueTokenIntrospector {
|
||||
|
||||
private static final String AUTHORITY_PREFIX = "SCOPE_";
|
||||
|
||||
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
|
||||
};
|
||||
|
||||
|
@ -58,8 +60,6 @@ public class SpringReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke
|
|||
|
||||
private final WebClient webClient;
|
||||
|
||||
private String authorityPrefix = "SCOPE_";
|
||||
|
||||
/**
|
||||
* Creates a {@code OpaqueTokenReactiveAuthenticationManager} with the provided
|
||||
* parameters
|
||||
|
@ -171,7 +171,7 @@ public class SpringReactiveOpaqueTokenIntrospector implements ReactiveOpaqueToke
|
|||
if (v instanceof String) {
|
||||
Collection<String> scopes = Arrays.asList(((String) v).split(" "));
|
||||
for (String scope : scopes) {
|
||||
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
|
||||
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
|
||||
}
|
||||
return scopes;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue