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 467cc17a6de..17003fb50d6 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 @@ 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 65fac639957..f258d8f4cab 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 @@ private JWTAuthConfiguration createJWTAuthConfiguration() { } 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");