瀏覽代碼

Polish OAuth2TokenContext

Joe Grandja 4 年之前
父節點
當前提交
53ed5b8481

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

@@ -84,7 +84,7 @@ public final class JwtEncodingContext implements OAuth2TokenContext {
 		}
 
 		public JwtEncodingContext build() {
-			return new JwtEncodingContext(this.context);
+			return new JwtEncodingContext(getContext());
 		}
 	}
 }

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

@@ -72,7 +72,7 @@ public interface OAuth2TokenContext extends Context {
 				Authentication.class.getName().concat(".PRINCIPAL");
 		private static final String AUTHORIZATION_GRANT_AUTHENTICATION_KEY =
 				Authentication.class.getName().concat(".AUTHORIZATION_GRANT");
-		protected final Map<Object, Object> context = new HashMap<>();
+		private final Map<Object, Object> context = new HashMap<>();
 
 		public B registeredClient(RegisteredClient registeredClient) {
 			return put(RegisteredClient.class, registeredClient);
@@ -119,8 +119,12 @@ public interface OAuth2TokenContext extends Context {
 			return (V) this.context.get(key);
 		}
 
+		protected Map<Object, Object> getContext() {
+			return this.context;
+		}
+
 		@SuppressWarnings("unchecked")
-		protected B getThis() {
+		protected final B getThis() {
 			return (B) this;
 		}