Skip to content

Commit

Permalink
Added condition to check size of headers
Browse files Browse the repository at this point in the history
  • Loading branch information
pierpaolo.didato@emeal.nttdata.com authored and pierpaolo.didato@emeal.nttdata.com committed Jul 12, 2024
1 parent d02caca commit c85780a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ public class AuthenticationPropagationHeadersFactory implements ClientHeadersFac

@Override
public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) {
final String uuid = incomingHeaders.get("user-uuid").get(0);
String bearerToken = tokenService.createJwt(uuid);
String bearerToken;
if (!incomingHeaders.isEmpty()) {
final String uuid = incomingHeaders.get("user-uuid").get(0);
bearerToken = tokenService.createJwt(uuid);
} else {
bearerToken = System.getenv("JWT_BEARER_TOKEN");
}
clientOutgoingHeaders.put("Authorization", List.of("Bearer " + bearerToken));
return clientOutgoingHeaders;
}
Expand Down

0 comments on commit c85780a

Please sign in to comment.