diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/token/SecurityTokenRepository.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/token/SecurityTokenRepository.java index 0adc155e1c..1d2d1146e5 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/token/SecurityTokenRepository.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/token/SecurityTokenRepository.java @@ -16,18 +16,18 @@ package org.springframework.security.oauth2.client.token; import org.springframework.security.oauth2.client.registration.ClientRegistration; -import org.springframework.security.oauth2.core.SecurityToken; +import org.springframework.security.oauth2.core.AbstractOAuth2Token; /** * Implementations of this interface are responsible for the persistence - * and association of a {@link SecurityToken} to a {@link ClientRegistration Client}. + * and association of an {@link AbstractOAuth2Token} to a {@link ClientRegistration Client}. * * @author Joe Grandja * @since 5.0 - * @see SecurityToken + * @see AbstractOAuth2Token * @see ClientRegistration */ -public interface SecurityTokenRepository { +public interface SecurityTokenRepository { T loadSecurityToken(ClientRegistration registration); diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/SecurityToken.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AbstractOAuth2Token.java similarity index 88% rename from oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/SecurityToken.java rename to oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AbstractOAuth2Token.java index 6db165df61..d0e3c79a95 100644 --- a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/SecurityToken.java +++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AbstractOAuth2Token.java @@ -22,18 +22,18 @@ import java.io.Serializable; import java.time.Instant; /** - * Base class for Security Token implementations. + * Base class for OAuth 2.0 Token implementations. * * @author Joe Grandja * @since 5.0 */ -public abstract class SecurityToken implements Serializable { +public abstract class AbstractOAuth2Token implements Serializable { private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; private final String tokenValue; private final Instant issuedAt; private final Instant expiresAt; - protected SecurityToken(String tokenValue, Instant issuedAt, Instant expiresAt) { + protected AbstractOAuth2Token(String tokenValue, Instant issuedAt, Instant expiresAt) { Assert.hasText(tokenValue, "tokenValue cannot be empty"); Assert.notNull(issuedAt, "issuedAt cannot be null"); Assert.notNull(expiresAt, "expiresAt cannot be null"); @@ -63,7 +63,7 @@ public abstract class SecurityToken implements Serializable { return false; } - SecurityToken that = (SecurityToken) obj; + AbstractOAuth2Token that = (AbstractOAuth2Token) obj; if (!this.getTokenValue().equals(that.getTokenValue())) { return false; diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AccessToken.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AccessToken.java index 1749c9b3ff..84b582a332 100644 --- a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AccessToken.java +++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/AccessToken.java @@ -22,7 +22,7 @@ import java.util.Collections; import java.util.Set; /** - * An implementation of a {@link SecurityToken} representing an OAuth 2.0 Access Token. + * An implementation of an {@link AbstractOAuth2Token} representing an OAuth 2.0 Access Token. * *

* An access token is a credential that represents an authorization @@ -34,7 +34,7 @@ import java.util.Set; * @since 5.0 * @see Section 1.4 Access Token */ -public class AccessToken extends SecurityToken { +public class AccessToken extends AbstractOAuth2Token { private final TokenType tokenType; private final Set scopes; diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/oidc/core/IdToken.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/oidc/core/IdToken.java index b2931f0b14..d3e3f1cecb 100644 --- a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/oidc/core/IdToken.java +++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/oidc/core/IdToken.java @@ -15,7 +15,7 @@ */ package org.springframework.security.oauth2.oidc.core; -import org.springframework.security.oauth2.core.SecurityToken; +import org.springframework.security.oauth2.core.AbstractOAuth2Token; import org.springframework.util.Assert; import java.time.Instant; @@ -24,7 +24,7 @@ import java.util.LinkedHashMap; import java.util.Map; /** - * An implementation of a {@link SecurityToken} representing an OpenID Connect Core 1.0 ID Token. + * An implementation of an {@link AbstractOAuth2Token} representing an OpenID Connect Core 1.0 ID Token. * *

* The IdToken is a security token that contains "Claims" @@ -32,13 +32,13 @@ import java.util.Map; * * @author Joe Grandja * @since 5.0 - * @see SecurityToken + * @see AbstractOAuth2Token * @see IdTokenClaimAccessor * @see StandardClaimAccessor * @see ID Token * @see Standard Claims */ -public class IdToken extends SecurityToken implements IdTokenClaimAccessor { +public class IdToken extends AbstractOAuth2Token implements IdTokenClaimAccessor { private final Map claims; public IdToken(String tokenValue, Instant issuedAt, Instant expiresAt, Map claims) { diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/Jwt.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/Jwt.java index fdde589fa6..c09c985566 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/Jwt.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/Jwt.java @@ -15,7 +15,7 @@ */ package org.springframework.security.oauth2.jwt; -import org.springframework.security.oauth2.core.SecurityToken; +import org.springframework.security.oauth2.core.AbstractOAuth2Token; import org.springframework.util.Assert; import java.time.Instant; @@ -24,7 +24,7 @@ import java.util.LinkedHashMap; import java.util.Map; /** - * An implementation of a {@link SecurityToken} representing a JSON Web Token (JWT). + * An implementation of an {@link AbstractOAuth2Token} representing a JSON Web Token (JWT). * *

* JWTs represent a set of "Claims" as a JSON object that may be encoded in a @@ -34,13 +34,13 @@ import java.util.Map; * * @author Joe Grandja * @since 5.0 - * @see SecurityToken + * @see AbstractOAuth2Token * @see JwtClaimAccessor * @see JSON Web Token (JWT) * @see JSON Web Signature (JWS) * @see JSON Web Encryption (JWE) */ -public class Jwt extends SecurityToken implements JwtClaimAccessor { +public class Jwt extends AbstractOAuth2Token implements JwtClaimAccessor { private final Map headers; private final Map claims; diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupport.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupport.java index 8ad8f20fff..7b543c20c5 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupport.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwtDecoderJwkSupport.java @@ -97,7 +97,7 @@ public class NimbusJwtDecoderJwkSupport implements JwtDecoder { if (jwtClaimsSet.getIssueTime() != null) { issuedAt = jwtClaimsSet.getIssueTime().toInstant(); } else { - // issuedAt is required in SecurityToken so let's default to expiresAt - 1 second + // issuedAt is required in AbstractOAuth2Token so let's default to expiresAt - 1 second issuedAt = Instant.from(expiresAt).minusSeconds(1); }