From ecf20593b7a6b83e287965ef44ed6f92c4264d28 Mon Sep 17 00:00:00 2001 From: tkuzynow Date: Mon, 15 Apr 2024 15:40:36 +0200 Subject: [PATCH] fix: technical resolver change to switch to new authentication objects --- .../tenant/TechnicalUserTenantResolver.java | 1 - .../TechnicalUserTenantResolverTest.java | 18 ++++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolver.java b/src/main/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolver.java index a76c800..388297e 100644 --- a/src/main/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolver.java +++ b/src/main/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolver.java @@ -43,7 +43,6 @@ private Collection getRealmRoles(Jwt jwt) { return Lists.newArrayList(); } - @Override public boolean canResolve(HttpServletRequest request) { return resolve(request).isPresent(); diff --git a/src/test/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolverTest.java b/src/test/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolverTest.java index 1ad7f46..88ff38a 100644 --- a/src/test/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolverTest.java +++ b/src/test/java/de/caritas/cob/videoservice/api/tenant/TechnicalUserTenantResolverTest.java @@ -1,6 +1,5 @@ package de.caritas.cob.videoservice.api.tenant; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; @@ -28,8 +27,7 @@ @ExtendWith(MockitoExtension.class) class TechnicalUserTenantResolverTest { public static final long TECHNICAL_CONTEXT = 0L; - @Mock - HttpServletRequest authenticatedRequest; + @Mock HttpServletRequest authenticatedRequest; @Mock(answer = Answers.RETURNS_DEEP_STUBS) KeycloakAuthenticationToken token; @@ -37,17 +35,13 @@ class TechnicalUserTenantResolverTest { @Mock(answer = Answers.RETURNS_DEEP_STUBS) AccessToken accessToken; - @Mock - Access access; + @Mock Access access; - @Mock - SecurityContext mockSecurityContext; + @Mock SecurityContext mockSecurityContext; - @Mock - Authentication mockAuthentication; + @Mock Authentication mockAuthentication; - @InjectMocks - TechnicalUserTenantResolver technicalUserTenantResolver; + @InjectMocks TechnicalUserTenantResolver technicalUserTenantResolver; @AfterEach public void tearDown() { @@ -94,4 +88,4 @@ private HashMap givenClaimMapContainingRole(String realmRole) { claimMap.put("realm_access", realmAccess); return claimMap; } -} \ No newline at end of file +}