From 76370a14eeea3ea2f8b4cddbf4d5dbcd95d476db Mon Sep 17 00:00:00 2001 From: Benjamin Seber Date: Fri, 19 Jan 2024 09:52:20 +0100 Subject: [PATCH] improve OAuth2UserServiceMultiTenantTest expiresAt must be after issuedAt --- .../security/OAuth2UserServiceMultiTenantTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/de/focusshift/zeiterfassung/security/OAuth2UserServiceMultiTenantTest.java b/src/test/java/de/focusshift/zeiterfassung/security/OAuth2UserServiceMultiTenantTest.java index cb58cfe7e..154d653c4 100644 --- a/src/test/java/de/focusshift/zeiterfassung/security/OAuth2UserServiceMultiTenantTest.java +++ b/src/test/java/de/focusshift/zeiterfassung/security/OAuth2UserServiceMultiTenantTest.java @@ -57,7 +57,7 @@ void ensureOriginalOidcUserWhenUserDoesNotExistYet() { final Map claims = Map.of(SUB, "uuid"); final ClientRegistration clientRegistration = ClientRegistration.withRegistrationId("most-awesome-tenant").authorizationGrantType(JWT_BEARER).build(); - final OAuth2AccessToken accessToken = new OAuth2AccessToken(BEARER, "token-value", Instant.now(), Instant.now()); + final OAuth2AccessToken accessToken = new OAuth2AccessToken(BEARER, "token-value", Instant.now(), Instant.now().plusNanos(1)); final OidcIdToken oidcToken = OidcIdToken.withTokenValue("token-value").claims(map -> map.putAll(claims)).build(); final OidcUserRequest oidcUserRequest = new OidcUserRequest(clientRegistration, accessToken, oidcToken); @@ -76,7 +76,7 @@ void ensureMergedRemoteAndApplicationAuthorities() { final Map claims = Map.of(SUB, "uuid"); final ClientRegistration clientRegistration = ClientRegistration.withRegistrationId("most-awesome-tenant").authorizationGrantType(JWT_BEARER).build(); - final OAuth2AccessToken accessToken = new OAuth2AccessToken(BEARER, "token-value", Instant.now(), Instant.now()); + final OAuth2AccessToken accessToken = new OAuth2AccessToken(BEARER, "token-value", Instant.now(), Instant.now().plusNanos(1)); final OidcIdToken oidcToken = OidcIdToken.withTokenValue("token-value").claims(map -> map.putAll(claims)).build(); final OidcUserRequest oidcUserRequest = new OidcUserRequest(clientRegistration, accessToken, oidcToken); @@ -97,7 +97,7 @@ void ensureSecurityContextIsSet() { final Map claims = Map.of(SUB, "uuid"); final ClientRegistration clientRegistration = ClientRegistration.withRegistrationId("most-awesome-tenant").authorizationGrantType(JWT_BEARER).build(); - final OAuth2AccessToken accessToken = new OAuth2AccessToken(BEARER, "token-value", Instant.now(), Instant.now()); + final OAuth2AccessToken accessToken = new OAuth2AccessToken(BEARER, "token-value", Instant.now(), Instant.now().plusNanos(1)); final OidcIdToken oidcToken = OidcIdToken.withTokenValue("token-value").claims(map -> map.putAll(claims)).build(); final OidcUserRequest oidcUserRequest = new OidcUserRequest(clientRegistration, accessToken, oidcToken);