refactor: rename kenoauth to identity and update dependencies accordingly
ZhenYi committed
Modified app/src/main.rs app/src/main.rs +7 −7 View app/src/main.rs
@@ -47,9 +47,9 @@
4747 let identity = match identity_config()? {
4848 Some(identity_config) => {
4949 let db =
50 kenoauth::db::DbConn::new(database.primary().clone(), database.replicas().to_vec());
50 identity::db::DbConn::new(database.primary().clone(), database.replicas().to_vec());
5151 Some(
52 kenoauth::oauth::start(&identity_config, db)
52 identity::oauth::start(&identity_config, db)
5353 .await
5454 .context("starting identity service")?,
5555 )
@@ -223,8 +223,8 @@
223223 info!("running schema migration");
224224 sync_schema(&db).await.context("running schema sync")?;
225225 if let Some(identity) = identity_config()? {
226 let identity_db = kenoauth::db::DbConn::new(db.clone(), Vec::new());
227 kenoauth::auth::migrate::sync_schema(&identity_db)
226 let identity_db = identity::db::DbConn::new(db.clone(), Vec::new());
227 identity::auth::migrate::sync_schema(&identity_db)
228228 .await
229229 .context("synchronizing identity schema")?;
230230 drop(identity);
@@ -283,7 +283,7 @@
283283 Ok(())
284284}
285285
286fn identity_config() -> anyhow::Result<Option<kenoauth::config::Config>> {
286fn identity_config() -> anyhow::Result<Option<identity::config::Config>> {
287287 let figment = config::loader::figment();
288288 let enabled = figment
289289 .extract_inner::<bool>("identity.enabled")
@@ -294,12 +294,12 @@
294294 let value: serde_json::Value = figment
295295 .extract_inner("identity")
296296 .context("loading [identity] configuration")?;
297 Ok(Some(kenoauth::config::Config::from_value(value)))
297 Ok(Some(identity::config::Config::from_value(value)))
298298}
299299
300300fn identity_openapi() -> anyhow::Result<()> {
301301 use utoipa_identity::OpenApi;
302 let doc = kenoauth::auth::openapi::ApiDoc::openapi();
302 let doc = identity::auth::openapi::ApiDoc::openapi();
303303 let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../lib/identity/OpenApi.Auth.json");
304304 std::fs::write(&path, doc.to_pretty_json()?).context("writing identity OpenAPI")?;
305305 println!("wrote {}", path.display());
Modified app/Cargo.toml app/Cargo.toml +1 −1 View app/Cargo.toml
@@ -7,7 +7,7 @@
77[dependencies]
88kenauth = { workspace = true }
99serde_json = { workspace = true }
10kenoauth = { workspace = true }
10identity = { workspace = true }
1111anyhow = { workspace = true }
1212auth = { workspace = true }
1313actix-web = { workspace = true }
Modified lib/auth/src/oauth/flow.rs lib/auth/src/oauth/flow.rs +4 −4 View lib/auth/src/oauth/flow.rs
@@ -79,7 +79,7 @@
7979 let config = &service.config().oauth;
8080 local_grant(
8181 service,
82 kenoauth::auth::protocol::TokenRequest {
82 identity::auth::protocol::TokenRequest {
8383 grant_type: "authorization_code".to_owned(),
8484 code: Some(code.to_owned()),
8585 redirect_uri: Some(redirect_uri.to_owned()),
@@ -100,7 +100,7 @@
100100 let config = &service.config().oauth;
101101 local_grant(
102102 service,
103 kenoauth::auth::protocol::TokenRequest {
103 identity::auth::protocol::TokenRequest {
104104 grant_type: "refresh_token".to_owned(),
105105 code: None,
106106 redirect_uri: None,
@@ -116,14 +116,14 @@
116116
117117async fn local_grant(
118118 service: &AuthService,
119 form: kenoauth::auth::protocol::TokenRequest,
119 form: identity::auth::protocol::TokenRequest,
120120) -> Result<TokenResponse, AuthError> {
121121 let client = service
122122 .state
123123 .kenauth
124124 .as_ref()
125125 .ok_or_else(|| AuthError::Internal("identity service is unavailable".to_owned()))?;
126 let value = kenoauth::auth::protocol::exchange_local(client.service(), &form)
126 let value = identity::auth::protocol::exchange_local(client.service(), &form)
127127 .await
128128 .map_err(|error| {
129129 if error.status >= 500 {
Modified lib/auth/Cargo.toml lib/auth/Cargo.toml +1 −1 View lib/auth/Cargo.toml
@@ -4,7 +4,7 @@
44edition.workspace = true
55
66[dependencies]
7kenoauth = { workspace = true }
7identity = { workspace = true }
88async-trait = { workspace = true }
99config = { workspace = true }
1010deletion = { workspace = true }
Modified lib/identity/Cargo.toml lib/identity/Cargo.toml +2 −2 View lib/identity/Cargo.toml
@@ -1,5 +1,5 @@
11[package]
2name = "kenoauth"
2name = "identity"
33version = "1.0.0"
44edition = "2024"
55publish = false
@@ -9,7 +9,7 @@
99license = "MIT"
1010
1111[lib]
12name = "kenoauth"
12name = "identity"
1313path = "src/lib.rs"
1414
1515[dependencies]
Modified lib/jwt/src/verifier.rs lib/jwt/src/verifier.rs +2 −2 View lib/jwt/src/verifier.rs
@@ -18,7 +18,7 @@
1818}
1919
2020pub struct JwtVerifier {
21 identity: Option<kenoauth::auth::AuthSvc>,
21 identity: Option<identity::auth::AuthSvc>,
2222 issuer: String,
2323 audience: String,
2424 chat_audience: String,
@@ -40,7 +40,7 @@
4040
4141 pub fn with_identity(
4242 config: &OAuthConfig,
43 identity: Option<kenoauth::auth::AuthSvc>,
43 identity: Option<identity::auth::AuthSvc>,
4444 ) -> Result<Arc<Self>, SessionError> {
4545 if config.issuer.is_empty() {
4646 return Err(SessionError::Verifier("oauth.issuer is empty".into()));
Modified lib/jwt/Cargo.toml lib/jwt/Cargo.toml +1 −1 View lib/jwt/Cargo.toml
@@ -4,7 +4,7 @@
44edition.workspace = true
55
66[dependencies]
7kenoauth = { workspace = true }
7identity = { workspace = true }
88config = { workspace = true }
99actix-web = { workspace = true }
1010serde = { workspace = true, features = ["derive"] }
Modified lib/kenauth/src/lib.rs lib/kenauth/src/lib.rs +3 −3 View lib/kenauth/src/lib.rs
@@ -1,3 +1,3 @@
1pub use kenoauth::client::KenAuthClient;
2pub use kenoauth::client::error::KenAuthError;
3pub use kenoauth::protos::auth as proto;
1pub use identity::client::KenAuthClient;
2pub use identity::client::error::KenAuthError;
3pub use identity::protos::auth as proto;
Modified lib/kenauth/Cargo.toml lib/kenauth/Cargo.toml +1 −1 View lib/kenauth/Cargo.toml
@@ -4,4 +4,4 @@
44edition.workspace = true
55
66[dependencies]
7kenoauth = { workspace = true }
7identity = { workspace = true }
Modified Cargo.lock Cargo.lock +73 −73 View Cargo.lock
@@ -784,9 +784,9 @@
784784 "hkdf 0.13.0",
785785 "hmac 0.13.0",
786786 "i18n",
787 "identity",
787788 "jwt",
788789 "kenauth",
789 "kenoauth",
790790 "maud",
791791 "models",
792792 "pulldown-cmark",
@@ -3495,6 +3495,75 @@
34953495checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
34963496
34973497[[package]]
3498name = "identity"
3499version = "1.0.0"
3500dependencies = [
3501 "accounts",
3502 "actix-web",
3503 "aes-gcm 0.11.1",
3504 "anyhow",
3505 "argon2",
3506 "async-trait",
3507 "base64 0.23.1",
3508 "bytes",
3509 "chrono",
3510 "config 1.0.0",
3511 "crypt",
3512 "db",
3513 "deadpool-redis",
3514 "ed25519-dalek",
3515 "email",
3516 "envelope",
3517 "events",
3518 "figment",
3519 "futures-util",
3520 "hmac 0.12.1",
3521 "http 1.5.0",
3522 "http-body 1.1.0",
3523 "kvcache",
3524 "lettre",
3525 "maud",
3526 "oltp",
3527 "opentelemetry",
3528 "opentelemetry-appender-tracing",
3529 "opentelemetry-otlp",
3530 "opentelemetry_sdk",
3531 "percent-encoding 2.3.2",
3532 "prost 0.14.4",
3533 "prost-types 0.14.4",
3534 "proto",
3535 "queue",
3536 "rand 0.10.3",
3537 "rand_core 0.6.4",
3538 "reqwest 0.13.5",
3539 "rocketmq-client-rust",
3540 "rocketmq-common",
3541 "rsa",
3542 "sea-orm",
3543 "serde",
3544 "serde_json",
3545 "session",
3546 "sha1 0.10.7",
3547 "sha2 0.10.9",
3548 "sqlparser",
3549 "thiserror 2.0.21",
3550 "token",
3551 "tokio",
3552 "tokio-stream",
3553 "tokio-util",
3554 "tonic",
3555 "tonic-health",
3556 "tonic-prost",
3557 "tonic-reflection",
3558 "tower",
3559 "tracing",
3560 "tracing-opentelemetry",
3561 "tracing-subscriber",
3562 "utoipa 6.0.0",
3563 "uuid",
3564]
3565
3566[[package]]
34983567name = "idna"
34993568version = "0.1.5"
35003569source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3834,8 +3903,8 @@
38343903 "actix-web",
38353904 "base64 0.23.1",
38363905 "config 1.0.0",
3906 "identity",
38373907 "jsonwebtoken 9.3.1",
3838 "kenoauth",
38393908 "reqwest 0.12.28",
38403909 "serde",
38413910 "serde_json",
@@ -3907,9 +3976,9 @@
39073976 "config 1.0.0",
39083977 "deletion",
39093978 "export",
3979 "identity",
39103980 "jwt",
39113981 "kenauth",
3912 "kenoauth",
39133982 "models",
39143983 "push",
39153984 "queue",
@@ -3929,76 +3998,7 @@
39293998name = "kenauth"
39303999version = "1.0.0"
39314000dependencies = [
3932 "kenoauth",
3933]
3934
3935[[package]]
3936name = "kenoauth"
3937version = "1.0.0"
3938dependencies = [
3939 "accounts",
3940 "actix-web",
3941 "aes-gcm 0.11.1",
3942 "anyhow",
3943 "argon2",
3944 "async-trait",
3945 "base64 0.23.1",
3946 "bytes",
3947 "chrono",
3948 "config 1.0.0",
3949 "crypt",
3950 "db",
3951 "deadpool-redis",
3952 "ed25519-dalek",
3953 "email",
3954 "envelope",
3955 "events",
3956 "figment",
3957 "futures-util",
3958 "hmac 0.12.1",
3959 "http 1.5.0",
3960 "http-body 1.1.0",
3961 "kvcache",
3962 "lettre",
3963 "maud",
3964 "oltp",
3965 "opentelemetry",
3966 "opentelemetry-appender-tracing",
3967 "opentelemetry-otlp",
3968 "opentelemetry_sdk",
3969 "percent-encoding 2.3.2",
3970 "prost 0.14.4",
3971 "prost-types 0.14.4",
3972 "proto",
3973 "queue",
3974 "rand 0.10.3",
3975 "rand_core 0.6.4",
3976 "reqwest 0.13.5",
3977 "rocketmq-client-rust",
3978 "rocketmq-common",
3979 "rsa",
3980 "sea-orm",
3981 "serde",
3982 "serde_json",
3983 "session",
3984 "sha1 0.10.7",
3985 "sha2 0.10.9",
3986 "sqlparser",
3987 "thiserror 2.0.21",
3988 "token",
3989 "tokio",
3990 "tokio-stream",
3991 "tokio-util",
3992 "tonic",
3993 "tonic-health",
3994 "tonic-prost",
3995 "tonic-reflection",
3996 "tower",
3997 "tracing",
3998 "tracing-opentelemetry",
3999 "tracing-subscriber",
4000 "utoipa 6.0.0",
4001 "uuid",
4001 "identity",
40024002]
40034003
40044004[[package]]
Modified Cargo.toml Cargo.toml +1 −1 View Cargo.toml
@@ -30,7 +30,7 @@
3030i18n = { path = "lib/i18n" }
3131imaging = { path = "lib/imaging" }
3232kenauth = { path = "lib/kenauth" }
33kenoauth = { path = "lib/identity" }
33identity = { path = "lib/identity" }
3434crypt = { path = "lib/crypt" }
3535db = { path = "lib/db" }
3636email = { path = "lib/email" }