From 7490a8162bf7d5cca42d806d2b36c50c48557e2d Mon Sep 17 00:00:00 2001
From: Steve Riesenberg <5248162+sjohnr@users.noreply.github.com>
Date: Tue, 10 Sep 2024 13:57:15 -0500
Subject: [PATCH] Deprecate default OAuth2AccessTokenResponseClients
Closes gh-15737
---
.../endpoint/DefaultAuthorizationCodeTokenResponseClient.java | 4 +++-
.../endpoint/DefaultClientCredentialsTokenResponseClient.java | 4 +++-
.../client/endpoint/DefaultJwtBearerTokenResponseClient.java | 4 +++-
.../endpoint/DefaultRefreshTokenTokenResponseClient.java | 4 +++-
.../endpoint/DefaultTokenExchangeTokenResponseClient.java | 2 ++
5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClient.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClient.java
index 179e564599..7467487528 100644
--- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClient.java
+++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultAuthorizationCodeTokenResponseClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 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,7 +52,9 @@ import org.springframework.web.client.RestTemplate;
* @see Section 4.1.4 Access Token Response
* (Authorization Code Grant)
+ * @deprecated Use {@link RestClientAuthorizationCodeTokenResponseClient} instead
*/
+@Deprecated(since = "6.4")
public final class DefaultAuthorizationCodeTokenResponseClient
implements OAuth2AccessTokenResponseClient {
diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClient.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClient.java
index 71f80977f5..99a8bbb0c8 100644
--- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClient.java
+++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultClientCredentialsTokenResponseClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 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,7 +52,9 @@ import org.springframework.web.client.RestTemplate;
* @see Section 4.4.3 Access Token Response
* (Client Credentials Grant)
+ * @deprecated Use {@link RestClientClientCredentialsTokenResponseClient} instead
*/
+@Deprecated(since = "6.4")
public final class DefaultClientCredentialsTokenResponseClient
implements OAuth2AccessTokenResponseClient {
diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClient.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClient.java
index fa145da534..48a4523c04 100644
--- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClient.java
+++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultJwtBearerTokenResponseClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 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.
@@ -50,7 +50,9 @@ import org.springframework.web.client.RestTemplate;
* 2.1 Using JWTs as Authorization Grants
* @see Section
* 4.1 Using Assertions as Authorization Grants
+ * @deprecated Use {@link RestClientJwtBearerTokenResponseClient} instead
*/
+@Deprecated(since = "6.4")
public final class DefaultJwtBearerTokenResponseClient
implements OAuth2AccessTokenResponseClient {
diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClient.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClient.java
index f42641bad2..35e2e37071 100644
--- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClient.java
+++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultRefreshTokenTokenResponseClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 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.
@@ -49,7 +49,9 @@ import org.springframework.web.client.RestTemplate;
* @see OAuth2AccessTokenResponse
* @see Section 6
* Refreshing an Access Token
+ * @deprecated Use {@link RestClientRefreshTokenTokenResponseClient} instead
*/
+@Deprecated(since = "6.4")
public final class DefaultRefreshTokenTokenResponseClient
implements OAuth2AccessTokenResponseClient {
diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultTokenExchangeTokenResponseClient.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultTokenExchangeTokenResponseClient.java
index 787e72ad87..3ba3d889f3 100644
--- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultTokenExchangeTokenResponseClient.java
+++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/DefaultTokenExchangeTokenResponseClient.java
@@ -50,7 +50,9 @@ import org.springframework.web.client.RestTemplate;
* 2.1 Request
* @see Section
* 2.2 Response
+ * @deprecated Use {@link RestClientRefreshTokenTokenResponseClient} instead
*/
+@Deprecated(since = "6.4")
public final class DefaultTokenExchangeTokenResponseClient
implements OAuth2AccessTokenResponseClient {