diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospector.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospector.java index 9fad1ffad1..ffb70c483e 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospector.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospector.java @@ -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> 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 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); diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java index 73bb1b953f..899b6e948e 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java @@ -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); diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringOpaqueTokenIntrospector.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringOpaqueTokenIntrospector.java index dabb44999f..2500c3f17e 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringOpaqueTokenIntrospector.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringOpaqueTokenIntrospector.java @@ -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> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { }; + private final Log logger = LogFactory.getLog(getClass()); + + private final RestOperations restOperations; + private Converter> 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 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; } diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringReactiveOpaqueTokenIntrospector.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringReactiveOpaqueTokenIntrospector.java index 1f0ac77e7f..0e6b19a6d0 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringReactiveOpaqueTokenIntrospector.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringReactiveOpaqueTokenIntrospector.java @@ -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> STRING_OBJECT_MAP = new ParameterizedTypeReference>() { }; @@ -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 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; }