Skip to content

Commit

Permalink
potential fix questionmark
Browse files Browse the repository at this point in the history
  • Loading branch information
GodCipher committed May 29, 2024
1 parent 7365e7c commit b7fb909
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ public ApiKeyAuthenticationProvider(String apiKey) {
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
ApiKeyAuthenticationToken authenticationToken = (ApiKeyAuthenticationToken) authentication;

if (apiKey.equals(authenticationToken.getCredentials())) {
return new ApiKeyAuthenticationToken(apiKey, apiKey);
if (authenticationToken.getCredentials() instanceof String credentials) {
if (apiKey.equals(credentials)) {
return new ApiKeyAuthenticationToken(apiKey, apiKey);
}
}

throw new BadCredentialsException("The API key was not found or not the expected value.");
Expand Down

0 comments on commit b7fb909

Please sign in to comment.