This is an automated email from the ASF dual-hosted git repository. jgallimore pushed a commit to branch tomee-9.x in repository https://gitbox.apache.org/repos/asf/tomee.git
commit a67e4034184479b5f4d0f2d0922ca43051b5278a Author: Zoltán Tichov <[email protected]> AuthorDate: Sun Dec 3 22:25:26 2023 +0100 Implement tomee.mp.jwt.allow.no-exp property over mp.jwt.tomee.allow.no-exp --- .../microprofile/jwt/itest/AllowNoExpPropertyTest.java | 2 +- .../jwt/config/JWTAuthConfigurationProperties.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/itests/microprofile-jwt-itests/src/test/java/org/apache/tomee/microprofile/jwt/itest/AllowNoExpPropertyTest.java b/itests/microprofile-jwt-itests/src/test/java/org/apache/tomee/microprofile/jwt/itest/AllowNoExpPropertyTest.java index 467cc17a6d..17003fb50d 100644 --- a/itests/microprofile-jwt-itests/src/test/java/org/apache/tomee/microprofile/jwt/itest/AllowNoExpPropertyTest.java +++ b/itests/microprofile-jwt-itests/src/test/java/org/apache/tomee/microprofile/jwt/itest/AllowNoExpPropertyTest.java @@ -45,7 +45,7 @@ import org.junit.Test; public class AllowNoExpPropertyTest { - + @Test public void testNewPropertyOverridesOld1() throws Exception { final Tokens tokens = Tokens.rsa(2048, 256); diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/config/JWTAuthConfigurationProperties.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/config/JWTAuthConfigurationProperties.java index 65fac63995..f258d8f4ca 100644 --- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/config/JWTAuthConfigurationProperties.java +++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/config/JWTAuthConfigurationProperties.java @@ -121,14 +121,15 @@ public class JWTAuthConfigurationProperties { } private Boolean queryAllowExp(){ - AtomicBoolean result = new AtomicBoolean(false); - config.getOptionalValue("mp.jwt.tomee.allow.no-exp", Boolean.class).ifPresent(value -> { - result.set(value); - CONFIGURATION.warning("mp.jwt.tomee.allow.no-exp property is deprecated, use tomee.mp.jwt.allow.no-exp propert instead."); - }); - return config.getOptionalValue("tomee.mp.jwt.allow.no-exp", Boolean.class).orElse(result.get()); + return config.getOptionalValue("tomee.mp.jwt.allow.no-exp", Boolean.class) + .or(() -> config.getOptionalValue("mp.jwt.tomee.allow.no-exp", Boolean.class) + .map(value -> { + CONFIGURATION.warning("mp.jwt.tomee.allow.no-exp property is deprecated, use tomee.mp.jwt.allow.no-exp propert instead."); + return value; + })) + .orElse(false); } - + enum Keys { VERIFY("mp.jwt.verify.publickey", "tomee.jwt.verify.publickey"), DECRYPT("mp.jwt.decrypt.key", "tomee.jwt.decrypt.key");
