From 1476676cecdce6c526168f35a8cdf0be1d91e9c0 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Thu, 20 Jan 2022 06:05:31 -0500 Subject: [PATCH] Deprecate JwtEncoder and associated classes Closes gh-596 --- .../org/springframework/security/oauth2/jwt/JoseHeader.java | 4 +++- .../springframework/security/oauth2/jwt/JoseHeaderNames.java | 4 +++- .../org/springframework/security/oauth2/jwt/JwtClaimsSet.java | 4 +++- .../org/springframework/security/oauth2/jwt/JwtEncoder.java | 4 +++- .../security/oauth2/jwt/JwtEncodingException.java | 4 +++- .../springframework/security/oauth2/jwt/NimbusJwsEncoder.java | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeader.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeader.java index 5430445b..1b7561e1 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeader.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeader.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,9 @@ import org.springframework.util.Assert; * @see JWT JOSE Header * @see JWS JOSE Header * @see JWE JOSE Header + * @deprecated See gh-596 */ +@Deprecated public final class JoseHeader { private final Map headers; diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeaderNames.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeaderNames.java index e53b66e6..4f63229a 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeaderNames.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JoseHeaderNames.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,9 @@ package org.springframework.security.oauth2.jwt; * @see JWT JOSE Header * @see JWS JOSE Header * @see JWE JOSE Header + * @deprecated See gh-596 */ +@Deprecated public final class JoseHeaderNames { /** diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java index dd1f7c36..b5648b1f 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,9 @@ import org.springframework.util.Assert; * @see Jwt * @see JwtClaimAccessor * @see JWT Claims Set + * @deprecated See gh-596 */ +@Deprecated public final class JwtClaimsSet implements JwtClaimAccessor { private final Map claims; diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncoder.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncoder.java index c32b7a85..4fa6d5f0 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncoder.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,9 @@ package org.springframework.security.oauth2.jwt; * @see JSON Web Encryption (JWE) * @see JWS Compact Serialization * @see JWE Compact Serialization + * @deprecated See gh-596 */ +@Deprecated @FunctionalInterface public interface JwtEncoder { diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncodingException.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncodingException.java index 4766d9a5..6ea866d0 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncodingException.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtEncodingException.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,9 @@ package org.springframework.security.oauth2.jwt; * * @author Joe Grandja * @since 0.0.1 + * @deprecated See gh-596 */ +@Deprecated public class JwtEncodingException extends JwtException { /** diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwsEncoder.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwsEncoder.java index aea60294..ec052dec 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwsEncoder.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/NimbusJwsEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,9 @@ import org.springframework.util.StringUtils; * @see JSON Web Signature (JWS) * @see JWS Compact Serialization * @see Nimbus JOSE + JWT SDK + * @deprecated See gh-596 */ +@Deprecated public final class NimbusJwsEncoder implements JwtEncoder { private static final String ENCODING_ERROR_MESSAGE_TEMPLATE = "An error occurred while attempting to encode the Jwt: %s"; private static final Converter JWS_HEADER_CONVERTER = new JwsHeaderConverter();