Skip to content

TOMEE-4297 fixing two failed tests #1109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading