浏览代码

Remove deprecations in AuthorizationRequestRepository

Closes gh-11519
Joe Grandja 3 年之前
父节点
当前提交
0e291a3295

+ 2 - 17
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/AuthorizationRequestRepository.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2022 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.
@@ -56,19 +56,6 @@ public interface AuthorizationRequestRepository<T extends OAuth2AuthorizationReq
 	 */
 	void saveAuthorizationRequest(T authorizationRequest, HttpServletRequest request, HttpServletResponse response);
 
-	/**
-	 * Removes and returns the {@link OAuth2AuthorizationRequest} associated to the
-	 * provided {@code HttpServletRequest} or if not available returns {@code null}.
-	 * @param request the {@code HttpServletRequest}
-	 * @return the removed {@link OAuth2AuthorizationRequest} or {@code null} if not
-	 * available
-	 * @deprecated Use
-	 * {@link #removeAuthorizationRequest(HttpServletRequest, HttpServletResponse)}
-	 * instead
-	 */
-	@Deprecated
-	T removeAuthorizationRequest(HttpServletRequest request);
-
 	/**
 	 * Removes and returns the {@link OAuth2AuthorizationRequest} associated to the
 	 * provided {@code HttpServletRequest} and {@code HttpServletResponse} or if not
@@ -78,8 +65,6 @@ public interface AuthorizationRequestRepository<T extends OAuth2AuthorizationReq
 	 * @return the {@link OAuth2AuthorizationRequest} or {@code null} if not available
 	 * @since 5.1
 	 */
-	default T removeAuthorizationRequest(HttpServletRequest request, HttpServletResponse response) {
-		return removeAuthorizationRequest(request);
-	}
+	T removeAuthorizationRequest(HttpServletRequest request, HttpServletResponse response);
 
 }

+ 4 - 9
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/HttpSessionOAuth2AuthorizationRequestRepository.java

@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2021 the original author or authors.
+ * Copyright 2002-2022 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.
@@ -81,8 +81,10 @@ public final class HttpSessionOAuth2AuthorizationRequestRepository
 	}
 
 	@Override
-	public OAuth2AuthorizationRequest removeAuthorizationRequest(HttpServletRequest request) {
+	public OAuth2AuthorizationRequest removeAuthorizationRequest(HttpServletRequest request,
+			HttpServletResponse response) {
 		Assert.notNull(request, "request cannot be null");
+		Assert.notNull(response, "response cannot be null");
 		String stateParameter = this.getStateParameter(request);
 		if (stateParameter == null) {
 			return null;
@@ -102,13 +104,6 @@ public final class HttpSessionOAuth2AuthorizationRequestRepository
 		return originalRequest;
 	}
 
-	@Override
-	public OAuth2AuthorizationRequest removeAuthorizationRequest(HttpServletRequest request,
-			HttpServletResponse response) {
-		Assert.notNull(response, "response cannot be null");
-		return this.removeAuthorizationRequest(request);
-	}
-
 	/**
 	 * Gets the state parameter from the {@link HttpServletRequest}
 	 * @param request the request to use