Skip to content

Commit

Permalink
Change logs in AtlasKeycloakAuthenticationProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
ektavarma10 committed Nov 9, 2023
1 parent 23dc215 commit 042c2f6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public Authentication authenticate(Authentication authentication) {
authentication = new KeycloakAuthenticationToken(token.getAccount(), token.isInteractive(), grantedAuthorities);
}
}
if(authentication.getName().startsWith("service-account-apikey")) {
LOG.info("validating request for service-account-apikey: {}", authentication.getName().substring("service-account-".length()));
if(authentication.getName().startsWith("service-account")) {
LOG.info("Validating request for clientId: {}", authentication.getName().substring("service-account-".length()));
try{
KeycloakAuthenticationToken keycloakToken = (KeycloakAuthenticationToken)authentication;
String bearerToken = keycloakToken.getAccount().getKeycloakSecurityContext().getTokenString();
Expand All @@ -96,8 +96,8 @@ public Authentication authenticate(Authentication authentication) {

private void handleInvalidApiKey(Authentication authentication) {
authentication.setAuthenticated(false);
LOG.info("Invalid API Key: {}", authentication.getName().substring("service-account-".length()));
throw new KeycloakAuthenticationException("Invalid Api Key");
LOG.info("Invalid clientId: {}", authentication.getName().substring("service-account-".length()));
throw new KeycloakAuthenticationException("Invalid ClientId");
}

@Override
Expand Down

0 comments on commit 042c2f6

Please sign in to comment.