Skip to content

Commit

Permalink
Release version 0.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
photino committed Dec 16, 2024
1 parent b7b4ffd commit 0d8c213
Show file tree
Hide file tree
Showing 38 changed files with 203 additions and 1,414 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
zino = { version = "0.28", features = ["axum"] }
zino = { version = "0.29", features = ["axum"] }
```

```rust
Expand All @@ -58,6 +58,7 @@ fn main() {
| [`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] |
| [`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] |
| [`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] |
| [`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] |
| [`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] |
| [`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] |
| [`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] |
Expand All @@ -82,6 +83,7 @@ If you have any problems or ideas, please don't hesitate to [open an issue][zino
[`zino-storage`]: https://github.com/zino-rs/zino/tree/main/crates/zino-storage
[`zino-http`]: https://github.com/zino-rs/zino/tree/main/crates/zino-http
[`zino-derive`]: https://github.com/zino-rs/zino/tree/main/crates/zino-derive
[`zino-orm`]: https://github.com/zino-rs/zino/tree/main/crates/zino-orm
[`zino-model`]: https://github.com/zino-rs/zino/tree/main/crates/zino-model
[`zino-extra`]: https://github.com/zino-rs/zino/tree/main/crates/zino-extra
[`zino-actix`]: https://github.com/zino-rs/zino/tree/main/crates/zino-actix
Expand All @@ -102,6 +104,8 @@ If you have any problems or ideas, please don't hesitate to [open an issue][zino
[zino-storage-docs]: https://docs.rs/zino-storage
[zino-http]: https://crates.io/crates/zino-http
[zino-http-docs]: https://docs.rs/zino-http
[zino-orm]: https://crates.io/crates/zino-orm
[zino-orm-docs]: https://docs.rs/zino-orm
[zino-derive]: https://crates.io/crates/zino-derive
[zino-derive-docs]: https://docs.rs/zino-derive
[zino-model]: https://crates.io/crates/zino-model
Expand Down
8 changes: 4 additions & 4 deletions crates/zino-actix/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-actix"
description = "Integrations with actix-web for zino."
version = "0.2.2"
version = "0.3.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -36,12 +36,12 @@ features = ["actix-web"]

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
features = ["openapi", "runtime-tokio"]
version = "0.30.0"
features = ["runtime-tokio"]

[dependencies.zino-http]
path = "../zino-http"
version = "0.1.3"
version = "0.2.0"
features = ["http02"]

[dependencies.zino-orm]
Expand Down
4 changes: 2 additions & 2 deletions crates/zino-amis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-amis"
description = "UI generator for amis."
version = "0.2.1"
version = "0.3.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -41,5 +41,5 @@ features = ["parse"]

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
version = "0.30.0"
features = ["tracing-subscriber"]
10 changes: 8 additions & 2 deletions crates/zino-auth/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-auth"
description = "Authentication and authorization for zino."
version = "0.1.3"
version = "0.2.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand All @@ -15,6 +15,7 @@ readme = "README.md"
[package.metadata.docs.rs]
features = [
"jwt",
"oidc",
"opa",
"sqids",
]
Expand All @@ -24,6 +25,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
crypto-sm = ["zino-core/crypto-sm"]
jwt = ["dep:jwt-simple", "regorus?/jwt"]
oidc = ["dep:rauthy-client"]
opa = ["regorus"]
sqids = ["dep:sqids"]

Expand All @@ -40,6 +42,10 @@ optional = true
default-features = false
features = ["pure-rust"]

[dependencies.rauthy-client]
version = "0.5.0"
optional = true

[dependencies.regorus]
version = "0.2.7"
optional = true
Expand Down Expand Up @@ -78,4 +84,4 @@ default-features = false

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
version = "0.30.0"
1 change: 1 addition & 0 deletions crates/zino-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following optional features are available:
|----------------------|--------------------------------------------------------|----------|
| `crypto-sm` | Enables China's Standards of Encryption Algorithms. | No |
| `jwt` | Enables the support for JSON Web Token. | No |
| `oidc` | Enables the support for OIDC via [`rauthy`]. | No |
| `opa` | Enables the support for OPA via [`regorus`]. | No |
| `sqids` | Enables the support for [`sqids`]. | No |

Expand Down
5 changes: 5 additions & 0 deletions crates/zino-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ pub use user_session::UserSession;

#[cfg(feature = "jwt")]
mod jwt_claims;
#[cfg(feature = "oidc")]
mod rauthy_client;
#[cfg(feature = "opa")]
mod rego_engine;

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

#[cfg(feature = "oidc")]
pub use rauthy_client::RauthyClient;

#[cfg(feature = "opa")]
pub use rego_engine::RegoEngine;
80 changes: 80 additions & 0 deletions crates/zino-auth/src/rauthy_client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
use rauthy_client::{
oidc_config::{ClaimMapping, JwtClaim, JwtClaimTyp, RauthyConfig},
provider::OidcProvider,
};
use std::collections::HashSet;
use zino_core::{
application::{Application, Plugin},
extension::TomlTableExt,
};

/// The Rauthy client.
#[derive(Debug, Clone, Copy)]
struct RauthyClient;

impl RauthyClient {
/// Initializes the Rauthy client and setups the OIDC provider.
pub fn init() -> Plugin {
let loader = Box::pin(async {
let Some(config) = Agent::config().get_table("rauthy") else {
tracing::warn!("`rauthy` config should be specified");
return;
};
let Some(client_id) = config.get_str("client-id") else {
tracing::warn!("`rauthy.client-id` should be specified");
return;
};
let Some(redirect_uri) = config.get_str("redirect-uri") else {
tracing::warn!("`rauthy.redirect-uri` should be specified");
return;
};
let Some(issuer_uri) = config.get_str("issuer-uri") else {
tracing::warn!("`rauthy.issuer-uri` should be specified");
return;
};
let audiences = if let Some(audiences) = config.get_str_array("audiences") {
HashSet::from_iter(audiences.into_iter().map(|s| s.to_owned()))
} else {
HashSet::from([client_id.to_owned()])
};
let group_claim = if let Some(groups) = config.get_str_array("groups") {
let claims = groups
.into_iter()
.map(|group| JwtClaim {
typ: JwtClaimTyp::Groups,
value: group.to_owned(),
})
.collect();
ClaimMapping::Or(claims)
} else {
ClaimMapping::Any
};
let scopes = config
.get_str_array("scopes")
.unwrap_or_else(|| vec!["openid"]);
let rauthy_config = RauthyConfig {
admin_claim: ClaimMapping::Or(vec![JwtClaim {
typ: JwtClaimTyp::Roles,
value: "admin".to_owned(),
}]),
user_claim: group_claim,
allowed_audiences: audiences,
client_id: client_id.to_owned(),
email_verified: config.get_bool("email-verified").unwrap_or_default(),
iss: issuer_uri.to_owned(),
scope: scopes.into_iter().map(|s| s.to_owned()).collect(),
secret: config.get_str("secret").map(|s| s.to_owned()),
};
if let Err(err) = rauthy_client::init().await {
tracing::error!("fail to initialize the Rauthy client: {err}");
}
if let Err(err) = OidcProvider::setup_from_config(rauthy_config, redirect_uri).await {
tracing::error!("fail to setup the OIDC provider: {err}");
}
Ok(())
});
let mut plugin = Plugin::new("rauthy-client");
plugin.set_loader(loader);
plugin
}
}
10 changes: 5 additions & 5 deletions crates/zino-axum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-axum"
description = "Integrations with axum for zino."
version = "0.2.2"
version = "0.3.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -41,7 +41,7 @@ features = [
]

[dependencies.tower]
version = "0.5.1"
version = "0.5.2"
features = ["timeout"]

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

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.2"
features = ["openapi", "runtime-tokio"]
version = "0.30.0"
features = ["runtime-tokio"]

[dependencies.zino-http]
path = "../zino-http"
version = "0.1.3"
version = "0.2.0"

[dependencies.zino-orm]
path = "../zino-orm"
Expand Down
4 changes: 2 additions & 2 deletions crates/zino-channel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-channel"
description = "Cloud events and subscriptions for zino."
version = "0.1.0"
version = "0.2.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -50,4 +50,4 @@ features = ["derive"]

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
version = "0.30.0"
4 changes: 2 additions & 2 deletions crates/zino-chatbot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-chatbot"
description = "Unified access to chatbot services for zino."
version = "0.1.0"
version = "0.2.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand All @@ -23,5 +23,5 @@ default-features = false

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
version = "0.30.0"
features = ["http-client"]
8 changes: 4 additions & 4 deletions crates/zino-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-cli"
description = "CLI tools for zino."
version = "0.5.1"
version = "0.5.2"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -55,14 +55,14 @@ version = "1.42.0"
features = ["full"]

[dependencies.tokio-stream]
version = "0.1.16"
version = "0.1.17"
features = ["net"]

[dependencies.zino]
path = "../zino"
version = "0.28.2"
version = "0.29.0"
features = ["axum"]

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
version = "0.30.0"
4 changes: 2 additions & 2 deletions crates/zino-connector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zino-connector"
description = "Unified connector to data sources for zino."
version = "0.0.1"
version = "0.1.0"
rust-version = "1.80"
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -106,4 +106,4 @@ optional = true

[dependencies.zino-core]
path = "../zino-core"
version = "0.29.3"
version = "0.30.0"
Loading

0 comments on commit 0d8c213

Please sign in to comment.