diff --git a/services/localega-tsd-proxy/src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java b/services/localega-tsd-proxy/src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java index cad6106c..6dd34058 100644 --- a/services/localega-tsd-proxy/src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java +++ b/services/localega-tsd-proxy/src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java @@ -78,10 +78,10 @@ public Object authenticateElixirAAI(ProceedingJoinPoint joinPoint) throws Throwa String jwtToken = optionalBearerAuth.get().replace("Bearer ", ""); try { var tokenArray = jwtToken.split("[.]"); - byte[] decodedHeader = Base64.getUrlDecoder().decode(tokenArray[0]); - String decodedHeaderString = new String(decodedHeader); + byte[] decodedPayload = Base64.getUrlDecoder().decode(tokenArray[1]); + String decodedPayloadString = new String(decodedPayload); Gson gson = new Gson(); - JsonObject claims = gson.fromJson(decodedHeaderString, JsonObject.class); + JsonObject claims = gson.fromJson(decodedPayloadString, JsonObject.class); List controlledAccessGrantsVisas = getVisas(jwtToken, claims.keySet()); log.info( "Elixir user {} authenticated and provided following valid GA4GH Visas: {}",