Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Merge pull request #135 from uio-bmi/bug-fix/error-in-reading-visas
Browse files Browse the repository at this point in the history
remove unnecessary dependencies, fix the bug that got the header of t…
  • Loading branch information
Parisa68 authored Feb 16, 2024
2 parents 063128f + 90fee27 commit 2041c6a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
15 changes: 0 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,6 @@
<artifactId>clearinghouse</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.12.3</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.12.3</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.12.3</version>
</dependency>
<dependency>
<groupId>no.uio.ifi</groupId>
<artifactId>tsd-file-api-client</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java
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: {}", claims.get(Claims.SUBJECT).getAsString(), controlledAccessGrantsVisas);
request.setAttribute(ELIXIR_ID, claims.get(Claims.SUBJECT).getAsString());
Expand Down

0 comments on commit 2041c6a

Please sign in to comment.