From f941df0009b006e20b1ad1b6d493a9a8169da6b0 Mon Sep 17 00:00:00 2001 From: adam-collins Date: Mon, 5 Jun 2023 13:32:31 +1000 Subject: [PATCH] Fix getAlaApiKeyClient bean initialization (#26) Co-authored-by: Adam Collins --- .../au/org/ala/ws/security/AlaWsSecurityConfiguration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ala-ws-security/src/main/java/au/org/ala/ws/security/AlaWsSecurityConfiguration.java b/ala-ws-security/src/main/java/au/org/ala/ws/security/AlaWsSecurityConfiguration.java index 21930762..0e3bc7e8 100644 --- a/ala-ws-security/src/main/java/au/org/ala/ws/security/AlaWsSecurityConfiguration.java +++ b/ala-ws-security/src/main/java/au/org/ala/ws/security/AlaWsSecurityConfiguration.java @@ -1,5 +1,6 @@ package au.org.ala.ws.security; +import au.org.ala.userdetails.UserDetailsClient; import au.org.ala.ws.security.authenticator.AlaApiKeyAuthenticator; import au.org.ala.ws.security.authenticator.AlaIpWhitelistAuthenticator; import au.org.ala.ws.security.authenticator.AlaOidcAuthenticator; @@ -167,7 +168,7 @@ public AlaOidcClient getAlaOidcClient(OidcConfiguration oidcConfiguration, JWKSo @Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix = "security.apikey", name = "enabled") - public AlaApiKeyClient getAlaApiKeyClient(ApiKeyClient apiKeyClient) { + public AlaApiKeyClient getAlaApiKeyClient(ApiKeyClient apiKeyClient, UserDetailsClient userDetailsClient) { AlaApiKeyCredentialsExtractor credentialsExtractor = new AlaApiKeyCredentialsExtractor(); credentialsExtractor.setHeaderName(apiKeyProperties.getHeader().getOverride()); @@ -175,6 +176,7 @@ public AlaApiKeyClient getAlaApiKeyClient(ApiKeyClient apiKeyClient) { AlaApiKeyAuthenticator authenticator = new AlaApiKeyAuthenticator(); authenticator.setApiKeyClient(apiKeyClient); + authenticator.setUserDetailsClient(userDetailsClient); return new AlaApiKeyClient(credentialsExtractor, authenticator); }