Skip to content

Commit

Permalink
Fix getAlaApiKeyClient bean initialization (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Collins <[email protected]>
  • Loading branch information
adam-collins and Adam Collins authored Jun 5, 2023
1 parent b0bf668 commit f941df0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -167,14 +168,15 @@ 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());
credentialsExtractor.setAlternativeHeaderNames(apiKeyProperties.getHeader().getAlternatives());

AlaApiKeyAuthenticator authenticator = new AlaApiKeyAuthenticator();
authenticator.setApiKeyClient(apiKeyClient);
authenticator.setUserDetailsClient(userDetailsClient);

return new AlaApiKeyClient(credentialsExtractor, authenticator);
}
Expand Down

0 comments on commit f941df0

Please sign in to comment.