Jelajahi Sumber

Make AuthorizationRequest serializable

Fixes gh-4627
Joe Grandja 7 tahun lalu
induk
melakukan
a77bdb0c5d

+ 5 - 1
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AuthorizationGrantType.java

@@ -15,8 +15,11 @@
  */
 package org.springframework.security.oauth2.core;
 
+import org.springframework.security.core.SpringSecurityCoreVersion;
 import org.springframework.util.Assert;
 
+import java.io.Serializable;
+
 /**
  * An authorization grant is a credential representing the resource owner's authorization
  * (to access it's protected resources) to the client and used by the client to obtain an access token.
@@ -30,7 +33,8 @@ import org.springframework.util.Assert;
  * @since 5.0
  * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-1.3">Section 1.3 Authorization Grant</a>
  */
-public final class AuthorizationGrantType {
+public final class AuthorizationGrantType implements Serializable {
+	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
 	public static final AuthorizationGrantType AUTHORIZATION_CODE = new AuthorizationGrantType("authorization_code");
 	public static final AuthorizationGrantType IMPLICIT = new AuthorizationGrantType("implicit");
 	private final String value;

+ 2 - 0
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/AuthorizationRequest.java

@@ -15,6 +15,7 @@
  */
 package org.springframework.security.oauth2.core.endpoint;
 
+import org.springframework.security.core.SpringSecurityCoreVersion;
 import org.springframework.security.oauth2.core.AuthorizationGrantType;
 import org.springframework.util.Assert;
 import org.springframework.util.CollectionUtils;
@@ -38,6 +39,7 @@ import java.util.Set;
  * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-4.2.1">Section 4.2.1 Implicit Grant Request</a>
  */
 public final class AuthorizationRequest implements Serializable {
+	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
 	private String authorizationUri;
 	private AuthorizationGrantType authorizationGrantType;
 	private ResponseType responseType;

+ 5 - 1
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/ResponseType.java

@@ -15,8 +15,11 @@
  */
 package org.springframework.security.oauth2.core.endpoint;
 
+import org.springframework.security.core.SpringSecurityCoreVersion;
 import org.springframework.util.Assert;
 
+import java.io.Serializable;
+
 /**
  * The <i>response_type</i> parameter is consumed by the authorization endpoint which
  * is used by the authorization code grant type and implicit grant type.
@@ -30,7 +33,8 @@ import org.springframework.util.Assert;
  * @since 5.0
  * @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-3.1.1">Section 3.1.1 Response Type</a>
  */
-public final class ResponseType {
+public final class ResponseType implements Serializable {
+	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
 	public static final ResponseType CODE = new ResponseType("code");
 	public static final ResponseType TOKEN = new ResponseType("token");
 	private final String value;