Claus Ibsen created CAMEL-27723:
-----------------------------------
Summary: camel-grpc - JWT tokens have no expiry
Key: CAMEL-27723
URL: https://issues.apache.org/jira/browse/CAMEL-27723
Project: Camel
Issue Type: Improvement
Components: camel-grpc
Reporter: Claus Ibsen
Fix For: 4.24.0
With {{authenticationType=JWT}} the JSON Web Tokens have no expiry.
* {{JwtHelper.createJwtToken()}} creates the token once, when the producer
starts, without the {{exp}} (expires at) and {{iat}} (issued at) claims. The
same token is sent on every call for the life of the producer.
* The consumer ({{JwtServerInterceptor}}, verifier from {{JwtHelper}} /
{{JwtServerInterceptor.prepareJwtVerifier}}) requires neither claim, so such a
token stays valid until {{jwtSecret}} changes.
* The table in grpc-component.adoc says {{negotiationType}} "NONE or TLS" for
JWT, but there is no NONE: the values are PLAINTEXT and TLS. With PLAINTEXT the
token is sent in clear text.
h3. Proposed change
* Producer: new option {{jwtTokenLifetime}} (default 1 hour). The producer
issues tokens with {{iat}} and {{exp}}, and creates a new token shortly before
the current one expires (lazily, when a call is made). 0 keeps the old tokens
without expiry.
* Consumer: new option {{jwtMaxTokenAge}} (default off), which rejects tokens
whose {{iat}} is older than this age (or that have no {{iat}}). Expired tokens
(with {{exp}}) are already rejected by java-jwt. Tokens without {{exp}} from
other clients keep working by default.
* Docs: PLAINTEXT instead of NONE, and TLS is strongly recommended with JWT.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)