Skip to content

Commit 373eb85

Browse files
committed
feat: token parsing exception propagated to gRPC status
1 parent 42d69c3 commit 373eb85

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/src/main/java/com/avast/grpc/jwt/server/JwtServerInterceptor.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
3939
token = tokenParser.parseToValid(authHeader.substring(AUTH_HEADER_PREFIX.length()));
4040
} catch (Exception e) {
4141
call.close(
42-
Status.UNAUTHENTICATED.withDescription(
43-
Constants.AuthorizationMetadataKey.name()
44-
+ " header validation failed: "
45-
+ e.getMessage()),
42+
Status.UNAUTHENTICATED
43+
.withDescription(
44+
Constants.AuthorizationMetadataKey.name()
45+
+ " header validation failed: "
46+
+ e.getMessage())
47+
.withCause(e),
4648
new Metadata());
4749
return new ServerCall.Listener<ReqT>() {};
4850
}

0 commit comments

Comments
 (0)