From d435f149eb05e5ad4e0b8f2792215e8f9ab5a121 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Mon, 30 Oct 2017 13:09:40 -0400 Subject: [PATCH] Polish spring-security-oauth2-jose Fixes gh-4755 --- .../{JwsAlgorithm.java => JwsAlgorithms.java} | 2 +- .../security/oauth2/jwt/JwtClaimAccessor.java | 16 ++++++++-------- .../jwt/{JwtClaim.java => JwtClaimNames.java} | 2 +- .../oauth2/jwt/NimbusJwtDecoderJwkSupport.java | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) rename oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/{JwsAlgorithm.java => JwsAlgorithms.java} (98%) rename oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/{JwtClaim.java => JwtClaimNames.java} (97%) diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithm.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithms.java similarity index 98% rename from oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithm.java rename to oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithms.java index 3f2eb32ac6..7fb672550f 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithm.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithms.java @@ -26,7 +26,7 @@ package org.springframework.security.oauth2.jose.jws; * @see JSON Web Signature (JWS) * @see Cryptographic Algorithms for Digital Signatures and MACs */ -public interface JwsAlgorithm { +public interface JwsAlgorithms { /** * HMAC using SHA-256 (Required) diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimAccessor.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimAccessor.java index cd3c42efce..6a3d1b146b 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimAccessor.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimAccessor.java @@ -28,37 +28,37 @@ import java.util.List; * @author Joe Grandja * @since 5.0 * @see ClaimAccessor - * @see JwtClaim + * @see JwtClaimNames * @see Jwt * @see Registered Claim Names */ public interface JwtClaimAccessor extends ClaimAccessor { default URL getIssuer() { - return this.getClaimAsURL(JwtClaim.ISS); + return this.getClaimAsURL(JwtClaimNames.ISS); } default String getSubject() { - return this.getClaimAsString(JwtClaim.SUB); + return this.getClaimAsString(JwtClaimNames.SUB); } default List getAudience() { - return this.getClaimAsStringList(JwtClaim.AUD); + return this.getClaimAsStringList(JwtClaimNames.AUD); } default Instant getExpiresAt() { - return this.getClaimAsInstant(JwtClaim.EXP); + return this.getClaimAsInstant(JwtClaimNames.EXP); } default Instant getNotBefore() { - return this.getClaimAsInstant(JwtClaim.NBF); + return this.getClaimAsInstant(JwtClaimNames.NBF); } default Instant getIssuedAt() { - return this.getClaimAsInstant(JwtClaim.IAT); + return this.getClaimAsInstant(JwtClaimNames.IAT); } default String getId() { - return this.getClaimAsString(JwtClaim.JTI); + return this.getClaimAsString(JwtClaimNames.JTI); } } diff --git a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaim.java b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimNames.java similarity index 97% rename from oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaim.java rename to oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimNames.java index 6d7c4d3d1f..8cdf231be7 100644 --- a/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaim.java +++ b/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimNames.java @@ -24,7 +24,7 @@ package org.springframework.security.oauth2.jwt; * @see JwtClaimAccessor * @see JWT Claims */ -public interface JwtClaim { +public interface JwtClaimNames { String ISS = "iss"; 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 7b543c20c5..55d605dcca 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 @@ -28,7 +28,7 @@ import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.JWTParser; import com.nimbusds.jwt.proc.ConfigurableJWTProcessor; import com.nimbusds.jwt.proc.DefaultJWTProcessor; -import org.springframework.security.oauth2.jose.jws.JwsAlgorithm; +import org.springframework.security.oauth2.jose.jws.JwsAlgorithms; import org.springframework.util.Assert; import java.net.MalformedURLException; @@ -54,13 +54,13 @@ import java.util.Map; * @see JSON Web Key (JWK) * @see Nimbus JOSE + JWT SDK */ -public class NimbusJwtDecoderJwkSupport implements JwtDecoder { +public final class NimbusJwtDecoderJwkSupport implements JwtDecoder { private final URL jwkSetUrl; private final JWSAlgorithm jwsAlgorithm; private final ConfigurableJWTProcessor jwtProcessor; public NimbusJwtDecoderJwkSupport(String jwkSetUrl) { - this(jwkSetUrl, JwsAlgorithm.RS256); + this(jwkSetUrl, JwsAlgorithms.RS256); } public NimbusJwtDecoderJwkSupport(String jwkSetUrl, String jwsAlgorithm) {