Ver Fonte

Polish spring-security-oauth2-jose

Fixes gh-4755
Joe Grandja há 7 anos atrás
pai
commit
d435f149eb

+ 1 - 1
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jose/jws/JwsAlgorithm.java → 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 <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/rfc7518#section-3">Cryptographic Algorithms for Digital Signatures and MACs</a>
  */
-public interface JwsAlgorithm {
+public interface JwsAlgorithms {
 
 	/**
 	 * HMAC using SHA-256 (Required)

+ 8 - 8
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 <a target="_blank" href="https://tools.ietf.org/html/rfc7519#section-4.1">Registered Claim Names</a>
  */
 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<String> 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);
 	}
 }

+ 1 - 1
oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtClaim.java → 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 <a target="_blank" href="https://tools.ietf.org/html/rfc7519#section-4">JWT Claims</a>
  */
-public interface JwtClaim {
+public interface JwtClaimNames {
 
 	String ISS = "iss";
 

+ 3 - 3
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 <a target="_blank" href="https://tools.ietf.org/html/rfc7517">JSON Web Key (JWK)</a>
  * @see <a target="_blank" href="https://connect2id.com/products/nimbus-jose-jwt">Nimbus JOSE + JWT SDK</a>
  */
-public class NimbusJwtDecoderJwkSupport implements JwtDecoder {
+public final class NimbusJwtDecoderJwkSupport implements JwtDecoder {
 	private final URL jwkSetUrl;
 	private final JWSAlgorithm jwsAlgorithm;
 	private final ConfigurableJWTProcessor<SecurityContext> jwtProcessor;
 
 	public NimbusJwtDecoderJwkSupport(String jwkSetUrl) {
-		this(jwkSetUrl, JwsAlgorithm.RS256);
+		this(jwkSetUrl, JwsAlgorithms.RS256);
 	}
 
 	public NimbusJwtDecoderJwkSupport(String jwkSetUrl, String jwsAlgorithm) {