| Crates.io | tower-oauth2-resource-server |
| lib.rs | tower-oauth2-resource-server |
| version | 0.6.0 |
| created_at | 2024-11-07 20:44:52.713795+00 |
| updated_at | 2025-09-03 05:43:02.159105+00 |
| description | Tower middleware that provides JWT authorization against an OpenID Connect (OIDC) Provider |
| homepage | https://github.com/Dunklas/tower-oauth2-resource-server |
| repository | https://github.com/Dunklas/tower-oauth2-resource-server |
| max_upload_size | |
| id | 1440162 |
| size | 141,008 |
Tower middleware that provides JWT authorization against an OpenID Connect (OIDC) Provider.
This crate is useful when an application has delegated authentication and/or authorization to an external authorization service (e.g. Auth0, Microsoft Entra, etc).
Main inspiration for this middleware (both in naming and functionality) is Spring Security OAuth 2.0 Resource Server.
The middleware will attempt to process each request by:
Authorization header (with Bearer prefix)jwks_urliss, exp, aud and possibly nbf scopes of the JWTIf validation fails, a HTTP 401 is returned. Otherwise next service in the middleware chain will be called. Claims of the JWT are made available as a Request extension. This enables you to write further application logic based on the claims, e.g. rejecting request that lack a certain scope.
See docs for OAuth2ResourceServerBuilder.
Check the examples.