Skip to content

Commit 53ed5b8

Browse files
committed
Polish OAuth2TokenContext
1 parent c89f2f3 commit 53ed5b8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/JwtEncodingContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public Builder claims(Consumer<JwtClaimsSet.Builder> claimsConsumer) {
8484
}
8585

8686
public JwtEncodingContext build() {
87-
return new JwtEncodingContext(this.context);
87+
return new JwtEncodingContext(getContext());
8888
}
8989
}
9090
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/OAuth2TokenContext.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ abstract class AbstractBuilder<T extends OAuth2TokenContext, B extends AbstractB
7272
Authentication.class.getName().concat(".PRINCIPAL");
7373
private static final String AUTHORIZATION_GRANT_AUTHENTICATION_KEY =
7474
Authentication.class.getName().concat(".AUTHORIZATION_GRANT");
75-
protected final Map<Object, Object> context = new HashMap<>();
75+
private final Map<Object, Object> context = new HashMap<>();
7676

7777
public B registeredClient(RegisteredClient registeredClient) {
7878
return put(RegisteredClient.class, registeredClient);
@@ -119,8 +119,12 @@ protected <V> V get(Object key) {
119119
return (V) this.context.get(key);
120120
}
121121

122+
protected Map<Object, Object> getContext() {
123+
return this.context;
124+
}
125+
122126
@SuppressWarnings("unchecked")
123-
protected B getThis() {
127+
protected final B getThis() {
124128
return (B) this;
125129
}
126130

0 commit comments

Comments
 (0)