Skip to content

Commit

Permalink
Implement tomee.mp.jwt.allow.no-exp property over mp.jwt.tomee.allow.…
Browse files Browse the repository at this point in the history
…no-exp
  • Loading branch information
tichovz authored and jgallimore committed Dec 6, 2023
1 parent 8414084 commit a67e403
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@


public class AllowNoExpPropertyTest {

@Test
public void testNewPropertyOverridesOld1() throws Exception {
final Tokens tokens = Tokens.rsa(2048, 256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a67e403

Please sign in to comment.