Polish spring-security-oauth2-jose

Fixes gh-4755
This commit is contained in:
Joe Grandja 2017-10-30 13:09:40 -04:00
parent 511d702ee0
commit d435f149eb
4 changed files with 13 additions and 13 deletions

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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";

View File

@ -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) {