Skip to content

Commit

Permalink
TOMEE-4297 fixing two failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tichovz authored and rzo1 committed Mar 14, 2024
1 parent b15012f commit e0930ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Ignore;
import org.junit.Test;


public class AllowNoExpPropertyTest {

//FIXME TOMEE-4297
@Ignore(value = "TOMEE-4297")
@Test
public void testNewPropertyOverridesOld1() throws Exception {
final Tokens tokens = Tokens.rsa(2048, 256);
Expand Down Expand Up @@ -92,8 +89,6 @@ public void testNewPropertyOverridesOld1() throws Exception {
assertNotPresent(output, "\tat org."); // no stack traces
}

//FIXME TOMEE-4297
@Ignore(value = "TOMEE-4297")
@Test
public void testNewPropertyOverridesOld2() throws Exception {
final Tokens tokens = Tokens.rsa(2048, 256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.tomee.microprofile.jwt.config;

import java.security.Key;
import java.util.Collections;
import java.util.Map;
import java.util.function.Supplier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

import static org.eclipse.microprofile.jwt.config.Names.AUDIENCES;
Expand Down Expand Up @@ -123,14 +122,17 @@ private JWTAuthConfiguration createJWTAuthConfiguration() {
config.getOptionalValue(TOKEN_AGE, Integer.class).orElse(null),
config.getOptionalValue(CLOCK_SKEW, Integer.class).orElse(0));
}

private Boolean queryAllowExp(){
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;
}))
final Optional<Boolean> allowExp = config.getOptionalValue("tomee.mp.jwt.allow.no-exp", Boolean.class);
final Optional<Boolean> allowExpDeprecatedValue = config.getOptionalValue("mp.jwt.tomee.allow.no-exp", Boolean.class);

if (allowExpDeprecatedValue.isPresent()) {
CONFIGURATION.warning("mp.jwt.tomee.allow.no-exp property is deprecated, use tomee.mp.jwt.allow.no-exp property instead.");
}

return allowExp
.or(() -> allowExpDeprecatedValue)
.orElse(false);
}

Expand Down

0 comments on commit e0930ab

Please sign in to comment.