Joe Grandja 5 месяцев назад
Родитель
Сommit
5bd47b6c2d
10 измененных файлов с 27 добавлено и 33 удалено
  1. 1 1
      docs/src/main/java/sample/extgrant/CustomCodeGrantAuthenticationProvider.java
  2. 4 5
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilter.java
  3. 3 4
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilter.java
  4. 3 4
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2DeviceAuthorizationEndpointFilter.java
  5. 3 4
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2DeviceVerificationEndpointFilter.java
  6. 3 4
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilter.java
  7. 3 4
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenRevocationEndpointFilter.java
  8. 3 3
      oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/authentication/OAuth2ErrorAuthenticationFailureHandler.java
  9. 3 3
      samples/demo-authorizationserver/src/main/java/sample/federation/FederatedIdentityAuthenticationSuccessHandler.java
  10. 1 1
      samples/demo-authorizationserver/src/main/java/sample/federation/FederatedIdentityIdTokenCustomizer.java

+ 1 - 1
docs/src/main/java/sample/extgrant/CustomCodeGrantAuthenticationProvider.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 4 - 5
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2AuthorizationEndpointFilter.java

@@ -173,9 +173,8 @@ public final class OAuth2AuthorizationEndpointFilter extends OncePerRequestFilte
 
 		try {
 			Authentication authentication = this.authenticationConverter.convert(request);
-			if (authentication instanceof AbstractAuthenticationToken abstractAuthenticationToken) {
-				abstractAuthenticationToken
-					.setDetails(this.authenticationDetailsSource.buildDetails(request));
+			if (authentication instanceof AbstractAuthenticationToken authenticationToken) {
+				authenticationToken.setDetails(this.authenticationDetailsSource.buildDetails(request));
 			}
 			Authentication authenticationResult = this.authenticationManager.authenticate(authentication);
 
@@ -188,13 +187,13 @@ public final class OAuth2AuthorizationEndpointFilter extends OncePerRequestFilte
 				return;
 			}
 
-			if (authenticationResult instanceof OAuth2AuthorizationConsentAuthenticationToken oAuth2AuthorizationConsentAuthenticationToken) {
+			if (authenticationResult instanceof OAuth2AuthorizationConsentAuthenticationToken authorizationConsentAuthenticationToken) {
 				if (this.logger.isTraceEnabled()) {
 					this.logger.trace("Authorization consent is required");
 				}
 				sendAuthorizationConsent(request, response,
 						(OAuth2AuthorizationCodeRequestAuthenticationToken) authentication,
-						oAuth2AuthorizationConsentAuthenticationToken);
+						authorizationConsentAuthenticationToken);
 				return;
 			}
 

+ 3 - 4
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2ClientAuthenticationFilter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -132,9 +132,8 @@ public final class OAuth2ClientAuthenticationFilter extends OncePerRequestFilter
 
 		try {
 			Authentication authenticationRequest = this.authenticationConverter.convert(request);
-			if (authenticationRequest instanceof AbstractAuthenticationToken abstractAuthenticationToken) {
-				abstractAuthenticationToken
-					.setDetails(this.authenticationDetailsSource.buildDetails(request));
+			if (authenticationRequest instanceof AbstractAuthenticationToken authenticationToken) {
+				authenticationToken.setDetails(this.authenticationDetailsSource.buildDetails(request));
 			}
 			if (authenticationRequest != null) {
 				validateClientIdentifier(authenticationRequest);

+ 3 - 4
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2DeviceAuthorizationEndpointFilter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -129,9 +129,8 @@ public final class OAuth2DeviceAuthorizationEndpointFilter extends OncePerReques
 
 		try {
 			Authentication deviceAuthorizationRequestAuthentication = this.authenticationConverter.convert(request);
-			if (deviceAuthorizationRequestAuthentication instanceof AbstractAuthenticationToken abstractAuthenticationToken) {
-				abstractAuthenticationToken
-					.setDetails(this.authenticationDetailsSource.buildDetails(request));
+			if (deviceAuthorizationRequestAuthentication instanceof AbstractAuthenticationToken authenticationToken) {
+				authenticationToken.setDetails(this.authenticationDetailsSource.buildDetails(request));
 			}
 
 			Authentication deviceAuthorizationRequestAuthenticationResult = this.authenticationManager

+ 3 - 4
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2DeviceVerificationEndpointFilter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -155,9 +155,8 @@ public final class OAuth2DeviceVerificationEndpointFilter extends OncePerRequest
 
 		try {
 			Authentication authentication = this.authenticationConverter.convert(request);
-			if (authentication instanceof AbstractAuthenticationToken abstractAuthenticationToken) {
-				abstractAuthenticationToken
-					.setDetails(this.authenticationDetailsSource.buildDetails(request));
+			if (authentication instanceof AbstractAuthenticationToken authenticationToken) {
+				authenticationToken.setDetails(this.authenticationDetailsSource.buildDetails(request));
 			}
 
 			Authentication authenticationResult = this.authenticationManager.authenticate(authentication);

+ 3 - 4
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenEndpointFilter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -161,9 +161,8 @@ public final class OAuth2TokenEndpointFilter extends OncePerRequestFilter {
 			if (authorizationGrantAuthentication == null) {
 				throwError(OAuth2ErrorCodes.UNSUPPORTED_GRANT_TYPE, OAuth2ParameterNames.GRANT_TYPE);
 			}
-			if (authorizationGrantAuthentication instanceof AbstractAuthenticationToken abstractAuthenticationToken) {
-				abstractAuthenticationToken
-					.setDetails(this.authenticationDetailsSource.buildDetails(request));
+			if (authorizationGrantAuthentication instanceof AbstractAuthenticationToken authenticationToken) {
+				authenticationToken.setDetails(this.authenticationDetailsSource.buildDetails(request));
 			}
 
 			OAuth2AccessTokenAuthenticationToken accessTokenAuthentication = (OAuth2AccessTokenAuthenticationToken) this.authenticationManager

+ 3 - 4
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OAuth2TokenRevocationEndpointFilter.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2024 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -114,9 +114,8 @@ public final class OAuth2TokenRevocationEndpointFilter extends OncePerRequestFil
 
 		try {
 			Authentication tokenRevocationAuthentication = this.authenticationConverter.convert(request);
-			if (tokenRevocationAuthentication instanceof AbstractAuthenticationToken abstractAuthenticationToken) {
-				abstractAuthenticationToken
-					.setDetails(this.authenticationDetailsSource.buildDetails(request));
+			if (tokenRevocationAuthentication instanceof AbstractAuthenticationToken authenticationToken) {
+				authenticationToken.setDetails(this.authenticationDetailsSource.buildDetails(request));
 			}
 
 			Authentication tokenRevocationAuthenticationResult = this.authenticationManager

+ 3 - 3
oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/authentication/OAuth2ErrorAuthenticationFailureHandler.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,8 +55,8 @@ public final class OAuth2ErrorAuthenticationFailureHandler implements Authentica
 		ServletServerHttpResponse httpResponse = new ServletServerHttpResponse(response);
 		httpResponse.setStatusCode(HttpStatus.BAD_REQUEST);
 
-		if (authenticationException instanceof OAuth2AuthenticationException oAuth2AuthenticationException) {
-			OAuth2Error error = oAuth2AuthenticationException.getError();
+		if (authenticationException instanceof OAuth2AuthenticationException oauth2AuthenticationException) {
+			OAuth2Error error = oauth2AuthenticationException.getError();
 			this.errorResponseConverter.write(error, null, httpResponse);
 		}
 		else {

+ 3 - 3
samples/demo-authorizationserver/src/main/java/sample/federation/FederatedIdentityAuthenticationSuccessHandler.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -52,8 +52,8 @@ public final class FederatedIdentityAuthenticationSuccessHandler implements Auth
 		if (authentication instanceof OAuth2AuthenticationToken) {
 			if (authentication.getPrincipal() instanceof OidcUser oidcUser) {
 				this.oidcUserHandler.accept(oidcUser);
-			} else if (authentication.getPrincipal() instanceof OAuth2User oAuth2User) {
-				this.oauth2UserHandler.accept(oAuth2User);
+			} else if (authentication.getPrincipal() instanceof OAuth2User oauth2User) {
+				this.oauth2UserHandler.accept(oauth2User);
 			}
 		}
 

+ 1 - 1
samples/demo-authorizationserver/src/main/java/sample/federation/FederatedIdentityIdTokenCustomizer.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2025 the original author or authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.