Skip to content

Commit 08e9643

Browse files
committed
DefaultCryptoSdJwsTest.shouldValidateAgeSinceIssued_IfJwtIsTooOld() sometimes fails in CI
closes #44971 Signed-off-by: mposolda <[email protected]>
1 parent 92314bc commit 08e9643

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

core/src/test/java/org/keycloak/sdjwt/SdJwsTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import static org.junit.Assert.assertEquals;
3636
import static org.junit.Assert.assertNotNull;
3737
import static org.junit.Assert.assertThrows;
38+
import static org.junit.Assert.assertTrue;
3839

3940
public abstract class SdJwsTest {
4041

@@ -195,12 +196,10 @@ public void shouldValidateAgeSinceIssued_IfJwtIsTooOld() {
195196
VerificationException exception = assertThrows(VerificationException.class, () -> {
196197
new ClaimVerifier.IatLifetimeCheck(0, maxLifetime).test(sdJws.getPayload());
197198
});
198-
assertEquals(String.format("Token has expired by iat: now: '%s', expired at: '%s', "
199-
+ "iat: '%s', maxLifetime: '%s'",
200-
now,
201-
iat + maxLifetime,
202-
iat,
203-
maxLifetime), exception.getMessage());
199+
200+
assertTrue(String.format("Expected message '%s' does not match regex", exception.getMessage()),
201+
exception.getMessage().matches("Token has expired by iat: now: '\\d+', expired at:"
202+
+ " '\\d+', iat: '\\d+', maxLifetime: '180'"));
204203
}
205204

206205
private JwsToken exampleSdJws(long iat) {

0 commit comments

Comments
 (0)