Skip to content

Commit e9d5bbb

Browse files
ascopesjzheaux
authored andcommitted
Fixed final field warnings in opaque token introspectors
1 parent 729418a commit e9d5bbb

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusOpaqueTokenIntrospector.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
*/
6262
public class NimbusOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
6363

64-
private final Log logger = LogFactory.getLog(getClass());
64+
private static final String AUTHORITY_PREFIX = "SCOPE_";
6565

66-
private Converter<String, RequestEntity<?>> requestEntityConverter;
66+
private final Log logger = LogFactory.getLog(getClass());
6767

68-
private RestOperations restOperations;
68+
private final RestOperations restOperations;
6969

70-
private final String authorityPrefix = "SCOPE_";
70+
private Converter<String, RequestEntity<?>> requestEntityConverter;
7171

7272
/**
7373
* Creates a {@code OpaqueTokenAuthenticationProvider} with the provided parameters
@@ -258,7 +258,7 @@ private OAuth2AuthenticatedPrincipal convertClaimsSet(TokenIntrospectionSuccessR
258258
List<String> scopes = Collections.unmodifiableList(response.getScope().toStringList());
259259
claims.put(OAuth2TokenIntrospectionClaimNames.SCOPE, scopes);
260260
for (String scope : scopes) {
261-
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
261+
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
262262
}
263263
}
264264
return new OAuth2IntrospectionAuthenticatedPrincipal(claims, authorities);

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/NimbusReactiveOpaqueTokenIntrospector.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@
5757
*/
5858
public class NimbusReactiveOpaqueTokenIntrospector implements ReactiveOpaqueTokenIntrospector {
5959

60+
private static final String AUTHORITY_PREFIX = "SCOPE_";
61+
6062
private final Log logger = LogFactory.getLog(getClass());
6163

6264
private final URI introspectionUri;
6365

6466
private final WebClient webClient;
6567

66-
private String authorityPrefix = "SCOPE_";
67-
6868
/**
6969
* Creates a {@code OpaqueTokenReactiveAuthenticationManager} with the provided
7070
* parameters
@@ -227,7 +227,7 @@ private OAuth2AuthenticatedPrincipal convertClaimsSet(TokenIntrospectionSuccessR
227227
claims.put(OAuth2TokenIntrospectionClaimNames.SCOPE, scopes);
228228

229229
for (String scope : scopes) {
230-
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
230+
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
231231
}
232232
}
233233
return new OAuth2IntrospectionAuthenticatedPrincipal(claims, authorities);

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringOpaqueTokenIntrospector.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@
5757
*/
5858
public class SpringOpaqueTokenIntrospector implements OpaqueTokenIntrospector {
5959

60-
private final Log logger = LogFactory.getLog(getClass());
60+
private static final String AUTHORITY_PREFIX = "SCOPE_";
6161

6262
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
6363
};
6464

65-
private Converter<String, RequestEntity<?>> requestEntityConverter;
65+
private final Log logger = LogFactory.getLog(getClass());
6666

67-
private RestOperations restOperations;
67+
private final RestOperations restOperations;
6868

69-
private final String authorityPrefix = "SCOPE_";
69+
private Converter<String, RequestEntity<?>> requestEntityConverter;
7070

7171
/**
7272
* Creates a {@code OpaqueTokenAuthenticationProvider} with the provided parameters
@@ -216,7 +216,7 @@ private OAuth2AuthenticatedPrincipal convertClaimsSet(Map<String, Object> claims
216216
if (v instanceof String) {
217217
Collection<String> scopes = Arrays.asList(((String) v).split(" "));
218218
for (String scope : scopes) {
219-
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
219+
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
220220
}
221221
return scopes;
222222
}

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/introspection/SpringReactiveOpaqueTokenIntrospector.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
*/
5252
public class SpringReactiveOpaqueTokenIntrospector implements ReactiveOpaqueTokenIntrospector {
5353

54+
private static final String AUTHORITY_PREFIX = "SCOPE_";
55+
5456
private static final ParameterizedTypeReference<Map<String, Object>> STRING_OBJECT_MAP = new ParameterizedTypeReference<Map<String, Object>>() {
5557
};
5658

5759
private final URI introspectionUri;
5860

5961
private final WebClient webClient;
6062

61-
private String authorityPrefix = "SCOPE_";
62-
6363
/**
6464
* Creates a {@code OpaqueTokenReactiveAuthenticationManager} with the provided
6565
* parameters
@@ -171,7 +171,7 @@ private OAuth2AuthenticatedPrincipal convertClaimsSet(Map<String, Object> claims
171171
if (v instanceof String) {
172172
Collection<String> scopes = Arrays.asList(((String) v).split(" "));
173173
for (String scope : scopes) {
174-
authorities.add(new SimpleGrantedAuthority(this.authorityPrefix + scope));
174+
authorities.add(new SimpleGrantedAuthority(AUTHORITY_PREFIX + scope));
175175
}
176176
return scopes;
177177
}

0 commit comments

Comments
 (0)