Skip to content

Commit

Permalink
Merge pull request #2470 from atlanhq/revert-2466-beta-token-metric
Browse files Browse the repository at this point in the history
Revert "Add counter for service-account api requests"
  • Loading branch information
ektavarma10 authored Nov 14, 2023
2 parents fc7a366 + f7fae67 commit ac82f75
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
*/
package org.apache.atlas.web.security;

import io.micrometer.core.instrument.Counter;
import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.keycloak.client.AtlasKeycloakClient;
import org.apache.atlas.service.metrics.MetricUtils;
import org.apache.commons.configuration.Configuration;
import org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
Expand Down Expand Up @@ -77,10 +75,8 @@ public Authentication authenticate(Authentication authentication) {
authentication = new KeycloakAuthenticationToken(token.getAccount(), token.isInteractive(), grantedAuthorities);
}
}
if(authentication.getName().startsWith("service-account-apikey")) {
if(authentication.getName().startsWith("service-account")) {
LOG.info("Validating request for clientId: {}", authentication.getName().substring("service-account-".length()));

Counter.builder("service_account_apikey_request_counter").register(MetricUtils.getMeterRegistry()).increment();
try{
KeycloakAuthenticationToken keycloakToken = (KeycloakAuthenticationToken)authentication;
String bearerToken = keycloakToken.getAccount().getKeycloakSecurityContext().getTokenString();
Expand Down

0 comments on commit ac82f75

Please sign in to comment.