Skip to content

Commit

Permalink
Merge pull request #88 from ELIXIR-NO/bugfix/error-in-reading-visas
Browse files Browse the repository at this point in the history
read the payload of the token instead of the header
  • Loading branch information
Parisa68 authored Feb 16, 2024
2 parents 6c845a3 + 1a75811 commit 6339a8f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Visa> controlledAccessGrantsVisas = getVisas(jwtToken, claims.keySet());
log.info(
"Elixir user {} authenticated and provided following valid GA4GH Visas: {}",
Expand Down

0 comments on commit 6339a8f

Please sign in to comment.