Skip to content

Commit

Permalink
Merge pull request #1 from majusko/hotfix/overriding-of-existing-toke…
Browse files Browse the repository at this point in the history
…n-with-internal

Added check for existing token.
  • Loading branch information
majusko authored Nov 10, 2019
2 parents 78dfd9a + dafb99b commit d6fbd96
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(

@Override
public void start(Listener<RespT> responseListener, final Metadata headers) {
final String authHeader = headers.get(GrpcHeader.AUTHORIZATION);

final String internalToken = jwtService.getInternal();

headers.put(GrpcHeader.AUTHORIZATION, internalToken);
if(authHeader == null || authHeader.isEmpty()) {
final String internalToken = jwtService.getInternal();
headers.put(GrpcHeader.AUTHORIZATION, internalToken);
}

final Listener<RespT> tracingResponseListener =
new ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT>(responseListener) {
Expand Down

0 comments on commit d6fbd96

Please sign in to comment.