Simple wrappers for tokens passed between services that rely on OAuth 2.0 for user authentication and authorization.
The value class presenting the OAuth 2.0 Bearer Token.
A value class used to represent the HTTP Authorization header expected to contain a Bearer Token, and which contains utility methods for extracting the Bearer Token from the header's value.
Parses and provides insight into a Json Web Token payload.
Provides a filter to inject user identifier information into slf4j and Jetty logging contexts.
Gradle:
dependencies {
implementation "com.palantir.tokens:auth-tokens:<version>"
implementation "com.palantir.tokens:auth-tokens-filter-jakarta:<version>"
}
In your server's initialize method:
environment.jersey().register(BearerTokenLoggingFeature.class);
This is a jax-rs DynamicFeature which sets up either the BearerTokenLoggingFilter
or the BearerTokenCookieLoggingFilter
in front of each of your endpoints, depending on whether they have a @HeaderParam("Authorization")
or a @CookieParam(*) BearerToken
. If your endpoint has neither of these parameters then no filter will be added.
Before working on the code, if you plan to contribute changes, please read the CONTRIBUTING document.
This repository is made available under the Apache 2.0 License.