mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-03-09 06:50:05 +00:00
Rename AbstractToken to SecurityToken
Fixes gh-4466
This commit is contained in:
parent
9b7883fe10
commit
33423c46d3
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.security.jwt;
|
||||
|
||||
import org.springframework.security.oauth2.core.AbstractToken;
|
||||
import org.springframework.security.oauth2.core.SecurityToken;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.time.Instant;
|
||||
@ -24,7 +24,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An implementation of an {@link AbstractToken} representing a <i>JSON Web Token (JWT)</i>.
|
||||
* An implementation of a {@link SecurityToken} representing a <i>JSON Web Token (JWT)</i>.
|
||||
*
|
||||
* <p>
|
||||
* JWTs represent a set of "Claims" as a JSON object that is encoded in a
|
||||
@ -34,13 +34,13 @@ import java.util.Map;
|
||||
*
|
||||
* @author Joe Grandja
|
||||
* @since 5.0
|
||||
* @see AbstractToken
|
||||
* @see SecurityToken
|
||||
* @see JwtClaimAccessor
|
||||
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc7519">JSON Web Token (JWT)</a>
|
||||
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc7515">JSON Web Signature (JWS)</a>
|
||||
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc7516">JSON Web Encryption (JWE)</a>
|
||||
*/
|
||||
public class Jwt extends AbstractToken implements JwtClaimAccessor {
|
||||
public class Jwt extends SecurityToken implements JwtClaimAccessor {
|
||||
private final Map<String, Object> headers;
|
||||
private final Map<String, Object> claims;
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class NimbusJwtDecoderJwkSupport implements JwtDecoder {
|
||||
if (jwtClaimsSet.getIssueTime() != null) {
|
||||
issuedAt = jwtClaimsSet.getIssueTime().toInstant();
|
||||
} else {
|
||||
// issuedAt is required in AbstractToken so let's default to expiresAt - 1 second
|
||||
// issuedAt is required in SecurityToken so let's default to expiresAt - 1 second
|
||||
issuedAt = Instant.from(expiresAt).minusSeconds(1);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An implementation of an {@link AbstractToken} representing an <i>OAuth 2.0 Access Token</i>.
|
||||
* An implementation of a {@link SecurityToken} representing an <i>OAuth 2.0 Access Token</i>.
|
||||
*
|
||||
* <p>
|
||||
* An access token is a credential that represents an authorization
|
||||
@ -35,7 +35,7 @@ import java.util.Set;
|
||||
* @since 5.0
|
||||
* @see <a target="_blank" href="https://tools.ietf.org/html/rfc6749#section-1.4">Section 1.4 Access Token</a>
|
||||
*/
|
||||
public class AccessToken extends AbstractToken {
|
||||
public class AccessToken extends SecurityToken {
|
||||
private final TokenType tokenType;
|
||||
private final Set<String> scopes;
|
||||
private final Map<String,Object> additionalParameters;
|
||||
|
@ -30,13 +30,13 @@ import java.time.Instant;
|
||||
* @author Joe Grandja
|
||||
* @since 5.0
|
||||
*/
|
||||
public abstract class AbstractToken implements Serializable {
|
||||
public abstract class SecurityToken implements Serializable {
|
||||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
|
||||
private final String tokenValue;
|
||||
private final Instant issuedAt;
|
||||
private final Instant expiresAt;
|
||||
|
||||
protected AbstractToken(String tokenValue, Instant issuedAt, Instant expiresAt) {
|
||||
protected SecurityToken(String tokenValue, Instant issuedAt, Instant expiresAt) {
|
||||
Assert.hasLength(tokenValue, "tokenValue cannot be empty");
|
||||
Assert.notNull(issuedAt, "issuedAt cannot be null");
|
||||
Assert.notNull(expiresAt, "expiresAt cannot be null");
|
||||
@ -66,7 +66,7 @@ public abstract class AbstractToken implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
AbstractToken that = (AbstractToken) obj;
|
||||
SecurityToken that = (SecurityToken) obj;
|
||||
|
||||
if (!this.getTokenValue().equals(that.getTokenValue())) {
|
||||
return false;
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.security.oauth2.oidc.core;
|
||||
|
||||
import org.springframework.security.oauth2.core.AbstractToken;
|
||||
import org.springframework.security.oauth2.core.SecurityToken;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.time.Instant;
|
||||
@ -24,7 +24,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An implementation of an {@link AbstractToken} representing an <i>OpenID Connect Core 1.0 ID Token</i>.
|
||||
* An implementation of a {@link SecurityToken} representing an <i>OpenID Connect Core 1.0 ID Token</i>.
|
||||
*
|
||||
* <p>
|
||||
* The <code>IdToken</code> is a security token that contains "Claims"
|
||||
@ -32,13 +32,13 @@ import java.util.Map;
|
||||
*
|
||||
* @author Joe Grandja
|
||||
* @since 5.0
|
||||
* @see AbstractToken
|
||||
* @see SecurityToken
|
||||
* @see IdTokenClaimAccessor
|
||||
* @see StandardClaimAccessor
|
||||
* @see <a target="_blank" href="http://openid.net/specs/openid-connect-core-1_0.html#IDToken">ID Token</a>
|
||||
* @see <a target="_blank" href="http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims">Standard Claims</a>
|
||||
*/
|
||||
public class IdToken extends AbstractToken implements IdTokenClaimAccessor {
|
||||
public class IdToken extends SecurityToken implements IdTokenClaimAccessor {
|
||||
private final Map<String, Object> claims;
|
||||
|
||||
public IdToken(String tokenValue, Instant issuedAt, Instant expiresAt, Map<String, Object> claims) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user