Skip to content

Commit 0d8c213

Browse files
committed
Release version 0.30.0
1 parent b7b4ffd commit 0d8c213

File tree

38 files changed

+203
-1414
lines changed

38 files changed

+203
-1414
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ version = "0.1.0"
3838
edition = "2021"
3939

4040
[dependencies]
41-
zino = { version = "0.28", features = ["axum"] }
41+
zino = { version = "0.29", features = ["axum"] }
4242
```
4343

4444
```rust
@@ -58,6 +58,7 @@ fn main() {
5858
| [`zino-channel`] | Cloud events and subscriptions. | [![Crates.io](https://img.shields.io/crates/v/zino-channel)][zino-channel] | [![Documentation](https://shields.io/docsrs/zino-channel)][zino-channel-docs] |
5959
| [`zino-storage`] | Files and storage services. | [![Crates.io](https://img.shields.io/crates/v/zino-storage)][zino-storage] | [![Documentation](https://shields.io/docsrs/zino-storage)][zino-storage-docs] |
6060
| [`zino-http`] | Requests and responses. | [![Crates.io](https://img.shields.io/crates/v/zino-http)][zino-http] | [![Documentation](https://shields.io/docsrs/zino-http)][zino-http-docs] |
61+
| [`zino-orm`] | Database schema and ORM. | [![Crates.io](https://img.shields.io/crates/v/zino-orm)][zino-orm] | [![Documentation](https://shields.io/docsrs/zino-orm)][zino-orm-docs] |
6162
| [`zino-derive`] | Derived traits. | [![Crates.io](https://img.shields.io/crates/v/zino-derive)][zino-derive] | [![Documentation](https://shields.io/docsrs/zino-derive)][zino-derive-docs] |
6263
| [`zino-model`] | Domain models. | [![Crates.io](https://img.shields.io/crates/v/zino-model)][zino-model] | [![Documentation](https://shields.io/docsrs/zino-model)][zino-model-docs] |
6364
| [`zino-extra`] | Extra utilities. | [![Crates.io](https://img.shields.io/crates/v/zino-extra)][zino-extra] | [![Documentation](https://shields.io/docsrs/zino-extra)][zino-extra-docs] |
@@ -82,6 +83,7 @@ If you have any problems or ideas, please don't hesitate to [open an issue][zino
8283
[`zino-storage`]: https://github.com/zino-rs/zino/tree/main/crates/zino-storage
8384
[`zino-http`]: https://github.com/zino-rs/zino/tree/main/crates/zino-http
8485
[`zino-derive`]: https://github.com/zino-rs/zino/tree/main/crates/zino-derive
86+
[`zino-orm`]: https://github.com/zino-rs/zino/tree/main/crates/zino-orm
8587
[`zino-model`]: https://github.com/zino-rs/zino/tree/main/crates/zino-model
8688
[`zino-extra`]: https://github.com/zino-rs/zino/tree/main/crates/zino-extra
8789
[`zino-actix`]: https://github.com/zino-rs/zino/tree/main/crates/zino-actix
@@ -102,6 +104,8 @@ If you have any problems or ideas, please don't hesitate to [open an issue][zino
102104
[zino-storage-docs]: https://docs.rs/zino-storage
103105
[zino-http]: https://crates.io/crates/zino-http
104106
[zino-http-docs]: https://docs.rs/zino-http
107+
[zino-orm]: https://crates.io/crates/zino-orm
108+
[zino-orm-docs]: https://docs.rs/zino-orm
105109
[zino-derive]: https://crates.io/crates/zino-derive
106110
[zino-derive-docs]: https://docs.rs/zino-derive
107111
[zino-model]: https://crates.io/crates/zino-model

crates/zino-actix/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-actix"
33
description = "Integrations with actix-web for zino."
4-
version = "0.2.2"
4+
version = "0.3.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -36,12 +36,12 @@ features = ["actix-web"]
3636

3737
[dependencies.zino-core]
3838
path = "../zino-core"
39-
version = "0.29.3"
40-
features = ["openapi", "runtime-tokio"]
39+
version = "0.30.0"
40+
features = ["runtime-tokio"]
4141

4242
[dependencies.zino-http]
4343
path = "../zino-http"
44-
version = "0.1.3"
44+
version = "0.2.0"
4545
features = ["http02"]
4646

4747
[dependencies.zino-orm]

crates/zino-amis/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-amis"
33
description = "UI generator for amis."
4-
version = "0.2.1"
4+
version = "0.3.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -41,5 +41,5 @@ features = ["parse"]
4141

4242
[dependencies.zino-core]
4343
path = "../zino-core"
44-
version = "0.29.3"
44+
version = "0.30.0"
4545
features = ["tracing-subscriber"]

crates/zino-auth/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-auth"
33
description = "Authentication and authorization for zino."
4-
version = "0.1.3"
4+
version = "0.2.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -15,6 +15,7 @@ readme = "README.md"
1515
[package.metadata.docs.rs]
1616
features = [
1717
"jwt",
18+
"oidc",
1819
"opa",
1920
"sqids",
2021
]
@@ -24,6 +25,7 @@ rustdoc-args = ["--cfg", "docsrs"]
2425
[features]
2526
crypto-sm = ["zino-core/crypto-sm"]
2627
jwt = ["dep:jwt-simple", "regorus?/jwt"]
28+
oidc = ["dep:rauthy-client"]
2729
opa = ["regorus"]
2830
sqids = ["dep:sqids"]
2931

@@ -40,6 +42,10 @@ optional = true
4042
default-features = false
4143
features = ["pure-rust"]
4244

45+
[dependencies.rauthy-client]
46+
version = "0.5.0"
47+
optional = true
48+
4349
[dependencies.regorus]
4450
version = "0.2.7"
4551
optional = true
@@ -78,4 +84,4 @@ default-features = false
7884

7985
[dependencies.zino-core]
8086
path = "../zino-core"
81-
version = "0.29.3"
87+
version = "0.30.0"

crates/zino-auth/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The following optional features are available:
1818
|----------------------|--------------------------------------------------------|----------|
1919
| `crypto-sm` | Enables China's Standards of Encryption Algorithms. | No |
2020
| `jwt` | Enables the support for JSON Web Token. | No |
21+
| `oidc` | Enables the support for OIDC via [`rauthy`]. | No |
2122
| `opa` | Enables the support for OPA via [`regorus`]. | No |
2223
| `sqids` | Enables the support for [`sqids`]. | No |
2324

crates/zino-auth/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,16 @@ pub use user_session::UserSession;
2323

2424
#[cfg(feature = "jwt")]
2525
mod jwt_claims;
26+
#[cfg(feature = "oidc")]
27+
mod rauthy_client;
2628
#[cfg(feature = "opa")]
2729
mod rego_engine;
2830

2931
#[cfg(feature = "jwt")]
3032
pub use jwt_claims::{default_time_tolerance, default_verification_options, JwtClaims, JwtHmacKey};
3133

34+
#[cfg(feature = "oidc")]
35+
pub use rauthy_client::RauthyClient;
36+
3237
#[cfg(feature = "opa")]
3338
pub use rego_engine::RegoEngine;

crates/zino-auth/src/rauthy_client.rs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
use rauthy_client::{
2+
oidc_config::{ClaimMapping, JwtClaim, JwtClaimTyp, RauthyConfig},
3+
provider::OidcProvider,
4+
};
5+
use std::collections::HashSet;
6+
use zino_core::{
7+
application::{Application, Plugin},
8+
extension::TomlTableExt,
9+
};
10+
11+
/// The Rauthy client.
12+
#[derive(Debug, Clone, Copy)]
13+
struct RauthyClient;
14+
15+
impl RauthyClient {
16+
/// Initializes the Rauthy client and setups the OIDC provider.
17+
pub fn init() -> Plugin {
18+
let loader = Box::pin(async {
19+
let Some(config) = Agent::config().get_table("rauthy") else {
20+
tracing::warn!("`rauthy` config should be specified");
21+
return;
22+
};
23+
let Some(client_id) = config.get_str("client-id") else {
24+
tracing::warn!("`rauthy.client-id` should be specified");
25+
return;
26+
};
27+
let Some(redirect_uri) = config.get_str("redirect-uri") else {
28+
tracing::warn!("`rauthy.redirect-uri` should be specified");
29+
return;
30+
};
31+
let Some(issuer_uri) = config.get_str("issuer-uri") else {
32+
tracing::warn!("`rauthy.issuer-uri` should be specified");
33+
return;
34+
};
35+
let audiences = if let Some(audiences) = config.get_str_array("audiences") {
36+
HashSet::from_iter(audiences.into_iter().map(|s| s.to_owned()))
37+
} else {
38+
HashSet::from([client_id.to_owned()])
39+
};
40+
let group_claim = if let Some(groups) = config.get_str_array("groups") {
41+
let claims = groups
42+
.into_iter()
43+
.map(|group| JwtClaim {
44+
typ: JwtClaimTyp::Groups,
45+
value: group.to_owned(),
46+
})
47+
.collect();
48+
ClaimMapping::Or(claims)
49+
} else {
50+
ClaimMapping::Any
51+
};
52+
let scopes = config
53+
.get_str_array("scopes")
54+
.unwrap_or_else(|| vec!["openid"]);
55+
let rauthy_config = RauthyConfig {
56+
admin_claim: ClaimMapping::Or(vec![JwtClaim {
57+
typ: JwtClaimTyp::Roles,
58+
value: "admin".to_owned(),
59+
}]),
60+
user_claim: group_claim,
61+
allowed_audiences: audiences,
62+
client_id: client_id.to_owned(),
63+
email_verified: config.get_bool("email-verified").unwrap_or_default(),
64+
iss: issuer_uri.to_owned(),
65+
scope: scopes.into_iter().map(|s| s.to_owned()).collect(),
66+
secret: config.get_str("secret").map(|s| s.to_owned()),
67+
};
68+
if let Err(err) = rauthy_client::init().await {
69+
tracing::error!("fail to initialize the Rauthy client: {err}");
70+
}
71+
if let Err(err) = OidcProvider::setup_from_config(rauthy_config, redirect_uri).await {
72+
tracing::error!("fail to setup the OIDC provider: {err}");
73+
}
74+
Ok(())
75+
});
76+
let mut plugin = Plugin::new("rauthy-client");
77+
plugin.set_loader(loader);
78+
plugin
79+
}
80+
}

crates/zino-axum/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-axum"
33
description = "Integrations with axum for zino."
4-
version = "0.2.2"
4+
version = "0.3.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -41,7 +41,7 @@ features = [
4141
]
4242

4343
[dependencies.tower]
44-
version = "0.5.1"
44+
version = "0.5.2"
4545
features = ["timeout"]
4646

4747
[dependencies.tower-http]
@@ -63,12 +63,12 @@ features = ["axum"]
6363

6464
[dependencies.zino-core]
6565
path = "../zino-core"
66-
version = "0.29.2"
67-
features = ["openapi", "runtime-tokio"]
66+
version = "0.30.0"
67+
features = ["runtime-tokio"]
6868

6969
[dependencies.zino-http]
7070
path = "../zino-http"
71-
version = "0.1.3"
71+
version = "0.2.0"
7272

7373
[dependencies.zino-orm]
7474
path = "../zino-orm"

crates/zino-channel/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-channel"
33
description = "Cloud events and subscriptions for zino."
4-
version = "0.1.0"
4+
version = "0.2.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -50,4 +50,4 @@ features = ["derive"]
5050

5151
[dependencies.zino-core]
5252
path = "../zino-core"
53-
version = "0.29.3"
53+
version = "0.30.0"

crates/zino-chatbot/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-chatbot"
33
description = "Unified access to chatbot services for zino."
4-
version = "0.1.0"
4+
version = "0.2.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -23,5 +23,5 @@ default-features = false
2323

2424
[dependencies.zino-core]
2525
path = "../zino-core"
26-
version = "0.29.3"
26+
version = "0.30.0"
2727
features = ["http-client"]

crates/zino-cli/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-cli"
33
description = "CLI tools for zino."
4-
version = "0.5.1"
4+
version = "0.5.2"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -55,14 +55,14 @@ version = "1.42.0"
5555
features = ["full"]
5656

5757
[dependencies.tokio-stream]
58-
version = "0.1.16"
58+
version = "0.1.17"
5959
features = ["net"]
6060

6161
[dependencies.zino]
6262
path = "../zino"
63-
version = "0.28.2"
63+
version = "0.29.0"
6464
features = ["axum"]
6565

6666
[dependencies.zino-core]
6767
path = "../zino-core"
68-
version = "0.29.3"
68+
version = "0.30.0"

crates/zino-connector/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "zino-connector"
33
description = "Unified connector to data sources for zino."
4-
version = "0.0.1"
4+
version = "0.1.0"
55
rust-version = "1.80"
66
edition = "2021"
77
license = "MIT"
@@ -106,4 +106,4 @@ optional = true
106106

107107
[dependencies.zino-core]
108108
path = "../zino-core"
109-
version = "0.29.3"
109+
version = "0.30.0"

0 commit comments

Comments
 (0)