mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-11 23:50:07 +01:00
chore: release 0.6.0
This commit is contained in:
parent
f1b11ecf3b
commit
3a6a31b418
4 changed files with 27 additions and 12 deletions
20
CHANGELOG.md
20
CHANGELOG.md
|
|
@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## 0.6.0 (2023-02-05)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- JwtAuthorizer::from_oidc(issuer_uri) - building from oidc discovery page
|
||||||
|
|
||||||
|
### Chnaged
|
||||||
|
|
||||||
|
- JwtAuthorizer::layer() becomes async
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- demo-server refactoring
|
||||||
|
|
||||||
## 0.5.0 - (2023-1-28)
|
## 0.5.0 - (2023-1-28)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
@ -47,10 +61,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## 0.3.0 - (2023-1-13)
|
## 0.3.0 - (2023-1-13)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- building the authorizer layer from rsa, ec, ed PEM files and from secret phrase (9bd99b2a)
|
- building the authorizer layer from rsa, ec, ed PEM files and from secret phrase (9bd99b2a)
|
||||||
|
|
||||||
## 0.2.0 - (2023-1-10)
|
## 0.2.0 - (2023-1-10)
|
||||||
|
|
||||||
Initial release
|
Initial release
|
||||||
|
|
|
||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -717,7 +717,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jwt-authorizer"
|
name = "jwt-authorizer"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "jwt-authorizer"
|
name = "jwt-authorizer"
|
||||||
description = "jwt authorizer middleware for axum"
|
description = "jwt authorizer middleware for axum"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["cduvray <c_duvray@proton.me>"]
|
authors = ["cduvray <c_duvray@proton.me>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
@ -31,4 +31,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hyper = { version = "0.14", features = ["full"] }
|
hyper = { version = "0.14", features = ["full"] }
|
||||||
tower = { version = "0.4", features = ["util"] }
|
tower = { version = "0.4", features = ["util"] }
|
||||||
wiremock = "0.5"
|
wiremock = "0.5"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ JWT authoriser Layer for Axum.
|
||||||
- Algoritms: ECDSA, RSA, EdDSA, HS
|
- Algoritms: ECDSA, RSA, EdDSA, HS
|
||||||
- JWKS endpoint support
|
- JWKS endpoint support
|
||||||
- Configurable refresh
|
- Configurable refresh
|
||||||
|
- OpenId Connect Discovery
|
||||||
- Claims extraction
|
- Claims extraction
|
||||||
- Claims checker
|
- Claims checker
|
||||||
|
|
||||||
|
|
@ -28,14 +29,14 @@ JWT authoriser Layer for Axum.
|
||||||
}
|
}
|
||||||
|
|
||||||
// let's create an authorizer builder from a JWKS Endpoint
|
// let's create an authorizer builder from a JWKS Endpoint
|
||||||
let jwt_auth: JwtAuthorizer<User> =
|
let jwt_auth: JwtAuthorizer<User> =
|
||||||
JwtAuthorizer::from_jwks_url("http://localhost:3000/oidc/jwks");
|
JwtAuthorizer::from_jwks_url("http://localhost:3000/oidc/jwks");
|
||||||
|
|
||||||
// adding the authorization layer
|
// adding the authorization layer
|
||||||
let app = Router::new().route("/protected", get(protected))
|
let app = Router::new().route("/protected", get(protected))
|
||||||
.layer(jwt_auth.layer().await.unwrap());
|
.layer(jwt_auth.layer().await.unwrap());
|
||||||
|
|
||||||
// proteced handler with user injection (mapping some jwt claims)
|
// proteced handler with user injection (mapping some jwt claims)
|
||||||
async fn protected(JwtClaims(user): JwtClaims<User>) -> Result<String, AuthError> {
|
async fn protected(JwtClaims(user): JwtClaims<User>) -> Result<String, AuthError> {
|
||||||
// Send the protected data to the user
|
// Send the protected data to the user
|
||||||
Ok(format!("Welcome: {}", user.sub))
|
Ok(format!("Welcome: {}", user.sub))
|
||||||
|
|
@ -48,7 +49,7 @@ JWT authoriser Layer for Axum.
|
||||||
|
|
||||||
## ClaimsChecker
|
## ClaimsChecker
|
||||||
|
|
||||||
A check function (mapping deserialized claims to boolean) can be added to the authorizer.
|
A check function (mapping deserialized claims to boolean) can be added to the authorizer.
|
||||||
|
|
||||||
A check failure results in a 403 (WWW-Authenticate: Bearer error="insufficient_scope") error.
|
A check failure results in a 403 (WWW-Authenticate: Bearer error="insufficient_scope") error.
|
||||||
|
|
||||||
|
|
@ -73,7 +74,7 @@ Example:
|
||||||
|
|
||||||
## JWKS Refresh
|
## JWKS Refresh
|
||||||
|
|
||||||
By default the jwks keys are reloaded when a request token is signed with a key (`kid` jwt header) that is not present in the store (a minimal intervale between 2 reloads is 10s by default, can be configured).
|
By default the jwks keys are reloaded when a request token is signed with a key (`kid` jwt header) that is not present in the store (a minimal intervale between 2 reloads is 10s by default, can be configured).
|
||||||
|
|
||||||
- `JwtAuthorizer::no_refresh()` configures one and unique reload of jwks keys
|
- `JwtAuthorizer::no_refresh()` configures one and unique reload of jwks keys
|
||||||
- `JwtAuthorizer::refresh(refresh_configuration)` allows to define a finer configuration for jwks refreshing, for more details see the documentation of `Refresh` struct.
|
- `JwtAuthorizer::refresh(refresh_configuration)` allows to define a finer configuration for jwks refreshing, for more details see the documentation of `Refresh` struct.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue