diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 122e4d1a..73e7f625 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -25,3 +25,21 @@ jobs: run: just - run: cargo clippy --all-features --no-deps - run: cargo test --all-features + + package_check: + name: Package Verification + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: bufbuild/buf-setup-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: extractions/setup-just@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - run: cargo install protoc-gen-prost-crate + - name: generated grpc code + run: just + - name: Verify package + run: cargo package --allow-dirty diff --git a/.gitignore b/.gitignore index 0001b227..ef8745e9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ Cargo.lock temp* src/api/generated -crates/zitadel-gen/src/api/ -.idea +.idea \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 9a9a1144..48320b6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,219 @@ -[workspace] -resolver = "2" -members = [ - "crates/zitadel", - "crates/zitadel-gen", +[package] +name = "zitadel" +description = "An implementation of ZITADEL API access and authentication in Rust." +version = "0.0.0-development" +edition = "2021" +license = "MIT OR Apache-2.0" +authors = ["Christoph Bühler "] +repository = "https://github.com/buehler/zitadel-rust" +keywords = ["ZITADEL", "gRPC", "clients", "authentication", "oidc"] +categories = ["authentication", "api-bindings"] +include = [ + "src/**/*.rs", + "Cargo.toml", + "LICENSE*", + "README.md", ] -[workspace.package] -version = "0.1.0" -authors = ["Christoph Bühler "] -description = "Rust Microservices for labs gallery" -license = "MIT OR Apache-2.0" -edition = "2021" \ No newline at end of file +[features] +default = ["tls-roots"] + +## Feature that enables support for the [actix framework](https://actix.rs/). +actix = ["credentials", "oidc", "dep:actix-web"] + +## The API feature enables all gRPC service clients to access the ZITADEL API. +api = [ + "api-admin-v1", + "api-auth-v1", + "api-management-v1", + "api-system-v1", + "api-oidc-v2", + "api-org-v2", + "api-session-v2", + "api-settings-v2", + "api-user-v2" +] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-admin-v1 = ["api-common", "zitadel-admin-v1" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-auth-v1 = ["api-common", "zitadel-auth-v1" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-management-v1 = ["api-common", "zitadel-v1-v1" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-system-v1 = ["api-common", "zitadel-system-v1", "zitadel-authn-v1" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-oidc-v2 = ["api-common", "zitadel-oidc-v2" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-org-v2 = ["api-common", "zitadel-org-v2", "zitadel-user-v2" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-session-v2 = ["api-common", "zitadel-session-v2" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-settings-v2 = ["api-common", "zitadel-settings-v2" ] +## The API feature enables all gRPC service clients to access the respective ZITADEL API. +api-user-v2 = ["api-common", "zitadel-user-v2" ] +api-common = ["dep:prost", "dep:prost-types", "dep:tonic", "dep:tonic-prost", "dep:pbjson-types" ] + +tls-roots = ["tonic/tls-native-roots"] +tls-webpki-roots = ["tonic/tls-webpki-roots"] + + +## Feature that enables support for the [axum framework](https://docs.rs/axum/latest/axum/). +axum = ["credentials", "oidc", "dep:axum", "dep:axum-extra"] + +## The credentials feature enables special credentials helpers for ZITADEL. +## For example, it allows the user to create a ZITADEL service account and +## authenticate against ZITADEL. +credentials = ["dep:jsonwebtoken", "dep:openidconnect", "dep:reqwest", "dep:serde", "dep:serde_json", "dep:serde_urlencoded", "dep:time"] + +## The interceptors feature enables specific gRPC interceptors and +## new convenience functions to create a gRPC client with interceptors. +## The interceptors provide easy access to an authenticated ZITADEL API client. +## The interceptors work with the credentials from this crate. +interceptors = ["credentials", "dep:time", "dep:tokio"] + +## This feature enables caching of the OIDC discovery and introspection results. +## By default, only the in-memory cache is available. To use a different cache, +## enable specific features of this crate, or implement your own cache with +## the trait. +introspection_cache = ["dep:async-trait", "dep:time", "dep:moka"] + +## The OIDC module enables basic OIDC (OpenID Connect) features to communicate +## with ZITADEL. Two examples are the `discover` and `introspect` functions. +## The OIDC features are required for some of the web framework features. +oidc = ["credentials", "dep:base64-compat"] + +## Feature that enables support for the [rocket framework](https://rocket.rs/). +## It enables authentication features for rocket in the form of route guards. +## Refer to the rocket module for more information. +rocket = ["credentials", "oidc", "dep:rocket"] + +## Feature that enables support for the [rocket okapi](https://github.com/GREsau/okapi). +rocket_okapi = ["rocket", "dep:rocket_okapi", "dep:schemars"] + +# @@protoc_deletion_point(features) +# This section is automatically generated by protoc-gen-prost-crate. +# Changes in this area may be lost on regeneration. +proto_full = ["zitadel-action-v1","zitadel-admin-v1","zitadel-app-v1","zitadel-auth-v1","zitadel-authn-v1","zitadel-change-v1","zitadel-event-v1","zitadel-feature-v1","zitadel-feature-v2","zitadel-feature-v2beta","zitadel-idp-v1","zitadel-idp-v2","zitadel-instance-v1","zitadel-management-v1","zitadel-member-v1","zitadel-metadata-v1","zitadel-milestone-v1","zitadel-object-v2","zitadel-object-v2beta","zitadel-object-v3alpha","zitadel-oidc-v2","zitadel-oidc-v2beta","zitadel-org-v1","zitadel-org-v2","zitadel-org-v2beta","zitadel-policy-v1","zitadel-project-v1","zitadel-protoc_gen_zitadel-v2","zitadel-quota-v1","zitadel-resources-action-v3alpha","zitadel-resources-debug_events-v3alpha","zitadel-resources-object-v3alpha","zitadel-resources-user-v3alpha","zitadel-resources-userschema-v3alpha","zitadel-resources-webkey-v3alpha","zitadel-saml-v2","zitadel-session-v2","zitadel-session-v2beta","zitadel-settings-object-v3alpha","zitadel-settings-v1","zitadel-settings-v2","zitadel-settings-v2beta","zitadel-system-v1","zitadel-text-v1","zitadel-user-v1","zitadel-user-v2","zitadel-user-v2beta","zitadel-v1","zitadel-v1-v1"] +"zitadel-action-v1" = ["zitadel-v1"] +"zitadel-admin-v1" = ["zitadel-event-v1","zitadel-idp-v1","zitadel-instance-v1","zitadel-management-v1","zitadel-member-v1","zitadel-milestone-v1","zitadel-org-v1","zitadel-policy-v1","zitadel-settings-v1","zitadel-text-v1","zitadel-v1","zitadel-v1-v1"] +"zitadel-app-v1" = ["zitadel-v1"] +"zitadel-auth-v1" = ["zitadel-change-v1","zitadel-idp-v1","zitadel-metadata-v1","zitadel-org-v1","zitadel-policy-v1","zitadel-user-v1","zitadel-v1"] +"zitadel-authn-v1" = ["zitadel-v1"] +"zitadel-change-v1" = ["zitadel-v1"] +"zitadel-event-v1" = ["zitadel-v1"] +"zitadel-feature-v1" = [] +"zitadel-feature-v2" = ["zitadel-object-v2"] +"zitadel-feature-v2beta" = ["zitadel-object-v2beta"] +"zitadel-idp-v1" = ["zitadel-v1"] +"zitadel-idp-v2" = ["zitadel-object-v2"] +"zitadel-instance-v1" = ["zitadel-v1"] +"zitadel-management-v1" = ["zitadel-action-v1","zitadel-app-v1","zitadel-authn-v1","zitadel-change-v1","zitadel-idp-v1","zitadel-member-v1","zitadel-metadata-v1","zitadel-org-v1","zitadel-policy-v1","zitadel-project-v1","zitadel-text-v1","zitadel-user-v1","zitadel-v1"] +"zitadel-member-v1" = ["zitadel-user-v1","zitadel-v1"] +"zitadel-metadata-v1" = ["zitadel-v1"] +"zitadel-milestone-v1" = [] +"zitadel-object-v2" = [] +"zitadel-object-v2beta" = [] +"zitadel-object-v3alpha" = [] +"zitadel-oidc-v2" = ["zitadel-object-v2"] +"zitadel-oidc-v2beta" = ["zitadel-object-v2beta"] +"zitadel-org-v1" = ["zitadel-v1"] +"zitadel-org-v2" = ["zitadel-object-v2"] +"zitadel-org-v2beta" = ["zitadel-object-v2beta"] +"zitadel-policy-v1" = ["zitadel-idp-v1","zitadel-v1"] +"zitadel-project-v1" = ["zitadel-v1"] +"zitadel-protoc_gen_zitadel-v2" = [] +"zitadel-quota-v1" = [] +"zitadel-resources-action-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] +"zitadel-resources-debug_events-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] +"zitadel-resources-object-v3alpha" = ["zitadel-object-v3alpha"] +"zitadel-resources-user-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] +"zitadel-resources-userschema-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] +"zitadel-resources-webkey-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] +"zitadel-saml-v2" = ["zitadel-object-v2"] +"zitadel-session-v2" = ["zitadel-object-v2","zitadel-v1"] +"zitadel-session-v2beta" = ["zitadel-object-v2beta","zitadel-v1"] +"zitadel-settings-object-v3alpha" = ["zitadel-object-v3alpha"] +"zitadel-settings-v1" = ["zitadel-v1"] +"zitadel-settings-v2" = ["zitadel-idp-v2","zitadel-object-v2"] +"zitadel-settings-v2beta" = ["zitadel-object-v2beta"] +"zitadel-system-v1" = ["zitadel-feature-v1","zitadel-instance-v1","zitadel-member-v1","zitadel-quota-v1","zitadel-v1"] +"zitadel-text-v1" = ["zitadel-v1"] +"zitadel-user-v1" = ["zitadel-v1"] +"zitadel-user-v2" = ["zitadel-object-v2"] +"zitadel-user-v2beta" = ["zitadel-object-v2beta"] +"zitadel-v1" = [] +"zitadel-v1-v1" = ["zitadel-authn-v1","zitadel-idp-v1","zitadel-management-v1","zitadel-org-v1","zitadel-v1"] +# @@protoc_insertion_point(features) + +[dependencies] +actix-web = { version = "4.5.1", optional = true } +async-trait = { version = "0.1.80", optional = true } +axum = { version = "0.8.0", optional = true, features = ["macros"] } +axum-extra = { version = "0.12.0", optional = true, features = ["typed-header"] } +base64-compat = { version = "1", optional = true } +custom_error = "1.9.2" +document-features = { version = "0.2.8", optional = true } +jsonwebtoken = { version = "10.3.0", optional = true, features = ["aws_lc_rs"] } +moka = { version = "0.12.8", features = ["future"], optional = true } +openidconnect = { version = "4.0.0", optional = true } +pbjson-types = { version = "0.9.0", optional = true } +prost = { version = "0.14.1", optional = true } +prost-types = { version = "0.14.1", optional = true } +tonic-prost = { version = "0.14.2", optional = true } +reqwest = { version = "0.12.12", features = ["json", "rustls-tls"], default-features = false, optional = true } +rocket = { version = "0.5.0", optional = true } +serde = { version = "1.0.200", features = ["derive"], optional = true } +serde_json = { version = "1.0.116", optional = true } +serde_urlencoded = { version = "0.7.1", optional = true } +time = { version = "0.3.36", optional = true } +tokio = { version = "1.37.0", optional = true, features = [ + "macros", + "rt-multi-thread", +] } +tonic = { version = "0.14.2", features = [ + "tls-aws-lc", +], optional = true } +rocket_okapi = { version = "0.9.0", optional = true, default-features = false } +schemars = {version = "0.8.21", optional = true} + +[dev-dependencies] +chrono = "0.4.38" +tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } +tower = { version = "0.5.0" } +http-body-util = "0.1.0" + +[package.metadata.docs.rs] +all-features = true + + +[[example]] +name = "actix_webapi_oauth_interception_basic" +required-features = ["actix"] + +[[example]] +name = "axum_webapi_oauth_interception_basic" +required-features = ["axum"] + +[[example]] +name = "fetch_profile_with_pat" +required-features = ["api", "interceptors"] + +[[example]] +name = "fetch_profile_with_service_account" +required-features = ["api", "interceptors"] + +[[example]] +name = "rocket_webapi_oauth_interception_basic" +required-features = ["rocket"] + +[[example]] +name = "rocket_webapi_oauth_interception_jwtprofile_cached" +required-features = ["rocket", "introspection_cache"] + +[[example]] +name = "rocket_webapi_oauth_interception_jwtprofile" +required-features = ["rocket"] + +[[example]] +name = "service_account_authentication" +required-features = ["credentials"] \ No newline at end of file diff --git a/buf.gen.yaml b/buf.gen.yaml index 8e616cc0..98fea4d4 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -4,19 +4,19 @@ managed: enabled: true plugins: - remote: buf.build/community/neoeinstein-prost:v0.5.0 - out: crates/zitadel-gen/src/api/ + out: src/api/generated opt: - compile_well_known_types - extern_path=.google.protobuf=::pbjson_types - remote: buf.build/community/neoeinstein-tonic:v0.5.0 - out: crates/zitadel-gen/src/api/ + out: src/api/generated opt: - compile_well_known_types - extern_path=.google.protobuf=::pbjson_types - no_server - local: protoc-gen-prost-crate - out: ./crates/zitadel-gen + out: . strategy: all opt: - - gen_crate=./crates/zitadel-gen/Cargo.toml - - include_file=src/api/mod.rs + - gen_crate + - include_file=src/api/generated/mod.rs \ No newline at end of file diff --git a/crates/zitadel-gen/Cargo.toml b/crates/zitadel-gen/Cargo.toml deleted file mode 100644 index 804538b1..00000000 --- a/crates/zitadel-gen/Cargo.toml +++ /dev/null @@ -1,70 +0,0 @@ -[package] -name = "zitadel-gen" -version = "2.71.19" -edition = "2021" - - -[features] -# @@protoc_deletion_point(features) -# This section is automatically generated by protoc-gen-prost-crate. -# Changes in this area may be lost on regeneration. -proto_full = ["zitadel-action-v1","zitadel-admin-v1","zitadel-app-v1","zitadel-auth-v1","zitadel-authn-v1","zitadel-change-v1","zitadel-event-v1","zitadel-feature-v1","zitadel-feature-v2","zitadel-feature-v2beta","zitadel-idp-v1","zitadel-idp-v2","zitadel-instance-v1","zitadel-management-v1","zitadel-member-v1","zitadel-metadata-v1","zitadel-milestone-v1","zitadel-object-v2","zitadel-object-v2beta","zitadel-object-v3alpha","zitadel-oidc-v2","zitadel-oidc-v2beta","zitadel-org-v1","zitadel-org-v2","zitadel-org-v2beta","zitadel-policy-v1","zitadel-project-v1","zitadel-protoc_gen_zitadel-v2","zitadel-quota-v1","zitadel-resources-action-v3alpha","zitadel-resources-debug_events-v3alpha","zitadel-resources-object-v3alpha","zitadel-resources-user-v3alpha","zitadel-resources-userschema-v3alpha","zitadel-resources-webkey-v3alpha","zitadel-saml-v2","zitadel-session-v2","zitadel-session-v2beta","zitadel-settings-object-v3alpha","zitadel-settings-v1","zitadel-settings-v2","zitadel-settings-v2beta","zitadel-system-v1","zitadel-text-v1","zitadel-user-v1","zitadel-user-v2","zitadel-user-v2beta","zitadel-v1","zitadel-v1-v1"] -"zitadel-action-v1" = ["zitadel-v1"] -"zitadel-admin-v1" = ["zitadel-event-v1","zitadel-idp-v1","zitadel-instance-v1","zitadel-management-v1","zitadel-member-v1","zitadel-milestone-v1","zitadel-org-v1","zitadel-policy-v1","zitadel-settings-v1","zitadel-text-v1","zitadel-v1","zitadel-v1-v1"] -"zitadel-app-v1" = ["zitadel-v1"] -"zitadel-auth-v1" = ["zitadel-change-v1","zitadel-idp-v1","zitadel-metadata-v1","zitadel-org-v1","zitadel-policy-v1","zitadel-user-v1","zitadel-v1"] -"zitadel-authn-v1" = ["zitadel-v1"] -"zitadel-change-v1" = ["zitadel-v1"] -"zitadel-event-v1" = ["zitadel-v1"] -"zitadel-feature-v1" = [] -"zitadel-feature-v2" = ["zitadel-object-v2"] -"zitadel-feature-v2beta" = ["zitadel-object-v2beta"] -"zitadel-idp-v1" = ["zitadel-v1"] -"zitadel-idp-v2" = ["zitadel-object-v2"] -"zitadel-instance-v1" = ["zitadel-v1"] -"zitadel-management-v1" = ["zitadel-action-v1","zitadel-app-v1","zitadel-authn-v1","zitadel-change-v1","zitadel-idp-v1","zitadel-member-v1","zitadel-metadata-v1","zitadel-org-v1","zitadel-policy-v1","zitadel-project-v1","zitadel-text-v1","zitadel-user-v1","zitadel-v1"] -"zitadel-member-v1" = ["zitadel-user-v1","zitadel-v1"] -"zitadel-metadata-v1" = ["zitadel-v1"] -"zitadel-milestone-v1" = [] -"zitadel-object-v2" = [] -"zitadel-object-v2beta" = [] -"zitadel-object-v3alpha" = [] -"zitadel-oidc-v2" = ["zitadel-object-v2"] -"zitadel-oidc-v2beta" = ["zitadel-object-v2beta"] -"zitadel-org-v1" = ["zitadel-v1"] -"zitadel-org-v2" = ["zitadel-object-v2"] -"zitadel-org-v2beta" = ["zitadel-object-v2beta"] -"zitadel-policy-v1" = ["zitadel-idp-v1","zitadel-v1"] -"zitadel-project-v1" = ["zitadel-v1"] -"zitadel-protoc_gen_zitadel-v2" = [] -"zitadel-quota-v1" = [] -"zitadel-resources-action-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] -"zitadel-resources-debug_events-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] -"zitadel-resources-object-v3alpha" = ["zitadel-object-v3alpha"] -"zitadel-resources-user-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] -"zitadel-resources-userschema-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] -"zitadel-resources-webkey-v3alpha" = ["zitadel-object-v3alpha","zitadel-resources-object-v3alpha"] -"zitadel-saml-v2" = ["zitadel-object-v2"] -"zitadel-session-v2" = ["zitadel-object-v2","zitadel-v1"] -"zitadel-session-v2beta" = ["zitadel-object-v2beta","zitadel-v1"] -"zitadel-settings-object-v3alpha" = ["zitadel-object-v3alpha"] -"zitadel-settings-v1" = ["zitadel-v1"] -"zitadel-settings-v2" = ["zitadel-idp-v2","zitadel-object-v2"] -"zitadel-settings-v2beta" = ["zitadel-object-v2beta"] -"zitadel-system-v1" = ["zitadel-feature-v1","zitadel-instance-v1","zitadel-member-v1","zitadel-quota-v1","zitadel-v1"] -"zitadel-text-v1" = ["zitadel-v1"] -"zitadel-user-v1" = ["zitadel-v1"] -"zitadel-user-v2" = ["zitadel-object-v2"] -"zitadel-user-v2beta" = ["zitadel-object-v2beta"] -"zitadel-v1" = [] -"zitadel-v1-v1" = ["zitadel-authn-v1","zitadel-idp-v1","zitadel-management-v1","zitadel-org-v1","zitadel-v1"] -# @@protoc_insertion_point(features) - -[dependencies] -anyhow = "1.0" -pbjson-types = { version = "0.9.0"} -prost = { version = "0.14.1", default-features = false, features = ["std"] } -prost-types = { version = "0.14.1", default-features = false } -regex = { version = "1.5.5", default-features = false } -tonic = "0.14.2" -tonic-prost = "0.14.2" \ No newline at end of file diff --git a/crates/zitadel-gen/LICENSE-APACHE b/crates/zitadel-gen/LICENSE-APACHE deleted file mode 100644 index 16fe87b0..00000000 --- a/crates/zitadel-gen/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/crates/zitadel-gen/LICENSE-MIT b/crates/zitadel-gen/LICENSE-MIT deleted file mode 100644 index 31aa7938..00000000 --- a/crates/zitadel-gen/LICENSE-MIT +++ /dev/null @@ -1,23 +0,0 @@ -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/crates/zitadel-gen/README.md b/crates/zitadel-gen/README.md deleted file mode 100644 index 1640609e..00000000 --- a/crates/zitadel-gen/README.md +++ /dev/null @@ -1 +0,0 @@ -oh yeah another readme.. \ No newline at end of file diff --git a/crates/zitadel-gen/src/lib.rs b/crates/zitadel-gen/src/lib.rs deleted file mode 100644 index a880cd62..00000000 --- a/crates/zitadel-gen/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -#[allow(clippy::all)] -pub mod api; - -#[allow(clippy::all)] -pub mod zitadel { - pub use crate::api::zitadel::*; -} diff --git a/crates/zitadel/Cargo.toml b/crates/zitadel/Cargo.toml deleted file mode 100644 index ad490456..00000000 --- a/crates/zitadel/Cargo.toml +++ /dev/null @@ -1,174 +0,0 @@ -[package] -name = "zitadel" -description = "An implementation of ZITADEL API access and authentication in Rust." -version = "0.0.0-development" -edition = "2021" -license = "MIT OR Apache-2.0" -authors = ["Christoph Bühler "] -repository = "https://github.com/buehler/zitadel-rust" -keywords = ["ZITADEL", "gRPC", "clients", "authentication", "oidc"] -categories = ["authentication", "api-bindings"] -include = [ - "src/**/*.rs", - "Cargo.toml", - "LICENSE*", - "README.md", -] - -[features] -default = ["tls-roots"] - -## Feature that enables support for the [actix framework](https://actix.rs/). -actix = ["credentials", "oidc", "dep:actix-web"] - -api-common = ["dep:tonic", "dep:zitadel-gen"] - -## The API feature enables all gRPC service clients to access the ZITADEL API. -api = [ - "api-admin-v1", - "api-auth-v1", - "api-management-v1", - "api-system-v1", - "api-oidc-v2", - "api-org-v2", - "api-session-v2", - "api-settings-v2", - "api-user-v2" -] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-admin-v1 = ["api-common", "zitadel-gen/zitadel-admin-v1" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-auth-v1 = ["api-common", "zitadel-gen/zitadel-auth-v1" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-management-v1 = ["api-common", "zitadel-gen/zitadel-v1-v1" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-system-v1 = ["api-common", "zitadel-gen/zitadel-system-v1", "zitadel-gen/zitadel-authn-v1" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-oidc-v2 = ["api-common", "zitadel-gen/zitadel-oidc-v2" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-org-v2 = ["api-common", "zitadel-gen/zitadel-org-v2", "zitadel-gen/zitadel-user-v2" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-session-v2 = ["api-common", "zitadel-gen/zitadel-session-v2" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-settings-v2 = ["api-common", "zitadel-gen/zitadel-settings-v2" ] -## The API feature enables all gRPC service clients to access the respective ZITADEL API. -api-user-v2 = ["api-common", "zitadel-gen/zitadel-user-v2" ] - - -tls-roots = ["tonic/tls-native-roots"] -tls-webpki-roots = ["tonic/tls-webpki-roots"] - - -## Feature that enables support for the [axum framework](https://docs.rs/axum/latest/axum/). -axum = ["credentials", "oidc", "dep:axum", "dep:axum-extra"] - -## The credentials feature enables special credentials helpers for ZITADEL. -## For example, it allows the user to create a ZITADEL service account and -## authenticate against ZITADEL. -credentials = ["dep:jsonwebtoken", "dep:openidconnect", "dep:reqwest", "dep:serde", "dep:serde_json", "dep:serde_urlencoded", "dep:time"] - -## The interceptors feature enables specific gRPC interceptors and -## new convenience functions to create a gRPC client with interceptors. -## The interceptors provide easy access to an authenticated ZITADEL API client. -## The interceptors work with the credentials from this crate. -interceptors = ["credentials", "dep:time", "dep:tokio"] - -## This feature enables caching of the OIDC discovery and introspection results. -## By default, only the in-memory cache is available. To use a different cache, -## enable specific features of this crate, or implement your own cache with -## the trait. -introspection_cache = ["dep:async-trait", "dep:time", "dep:moka"] - -## The OIDC module enables basic OIDC (OpenID Connect) features to communicate -## with ZITADEL. Two examples are the `discover` and `introspect` functions. -## The OIDC features are required for some of the web framework features. -oidc = ["credentials", "dep:base64-compat"] - -## Feature that enables support for the [rocket framework](https://rocket.rs/). -## It enables authentication features for rocket in the form of route guards. -## Refer to the rocket module for more information. -rocket = ["credentials", "oidc", "dep:rocket"] - -## Feature that enables support for the [rocket okapi](https://github.com/GREsau/okapi). -rocket_okapi = ["rocket", "dep:rocket_okapi", "dep:schemars"] - - - -[dependencies] -actix-web = { version = "4.5.1", optional = true } -async-trait = { version = "0.1.80", optional = true } -axum = { version = "0.8.0", optional = true, features = ["macros"] } -axum-extra = { version = "0.12.0", optional = true, features = ["typed-header"] } #0.11.0 is yanked -base64-compat = { version = "1", optional = true } -custom_error = "1.9.2" -document-features = { version = "0.2.8", optional = true } -jsonwebtoken = { version = "10.3.0", optional = true, features = ["aws_lc_rs"] } -moka = { version = "0.12.8", features = ["future"], optional = true } -openidconnect = { version = "4.0.0", optional = true } -reqwest = { version = "0.12.12", features = ["json", "rustls-tls"], default-features = false, optional = true } -rocket = { version = "0.5.0", optional = true } -serde = { version = "1.0.200", features = ["derive"], optional = true } -serde_json = { version = "1.0.116", optional = true } -serde_urlencoded = { version = "0.7.1", optional = true } -time = { version = "0.3.36", optional = true } -tokio = { version = "1.37.0", optional = true, features = [ - "macros", - "rt-multi-thread", -] } -tonic = { version = "0.14.2", features = [ - "tls-ring", -], optional = true } -rocket_okapi = { version = "0.9.0", optional = true, default-features = false } -schemars = {version = "0.8.21", optional = true} - -zitadel-gen = { path = "../zitadel-gen", version = "2.71", optional = true } - -[dev-dependencies] -chrono = "0.4.38" -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } -tower = { version = "0.5.0" } -http-body-util = "0.1.0" - -[package.metadata.docs.rs] -all-features = true - - -[[example]] -name = "actix_webapi_oauth_interception_basic" -required-features = ["actix"] -path = "examples/actix_webapi_oauth_interception_basic.rs" - -[[example]] -name = "axum_webapi_oauth_interception_basic" -required-features = ["axum"] -path = "examples/axum_webapi_oauth_interception_basic.rs" - -[[example]] -name = "fetch_profile_with_pat" -required-features = ["api", "interceptors"] -path = "examples/fetch_profile_with_pat.rs" - -[[example]] -name = "fetch_profile_with_service_account" -required-features = ["api", "interceptors"] -path = "examples/fetch_profile_with_service_account.rs" - -[[example]] -name = "rocket_webapi_oauth_interception_basic" -required-features = ["rocket"] -path = "examples/rocket_webapi_oauth_interception_basic.rs" - -[[example]] -name = "rocket_webapi_oauth_interception_jwtprofile_cached" -required-features = ["rocket", "introspection_cache"] -path = "examples/rocket_webapi_oauth_interception_jwtprofile_cached.rs" - -[[example]] -name = "rocket_webapi_oauth_interception_jwtprofile" -required-features = ["rocket"] -path = "examples/rocket_webapi_oauth_interception_jwtprofile.rs" - -[[example]] -name = "service_account_authentication" -required-features = ["credentials"] -path = "examples/service_account_authentication.rs" diff --git a/crates/zitadel/LICENSE-APACHE b/crates/zitadel/LICENSE-APACHE deleted file mode 100644 index 16fe87b0..00000000 --- a/crates/zitadel/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/crates/zitadel/LICENSE-MIT b/crates/zitadel/LICENSE-MIT deleted file mode 100644 index 31aa7938..00000000 --- a/crates/zitadel/LICENSE-MIT +++ /dev/null @@ -1,23 +0,0 @@ -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/crates/zitadel/README.md b/crates/zitadel/README.md deleted file mode 100644 index 568be8af..00000000 --- a/crates/zitadel/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# ZITADEL for Rust   [![Crates.io](https://img.shields.io/crates/v/zitadel)](https://crates.io/crates/zitadel) [![docs.rs](https://img.shields.io/docsrs/zitadel)](https://docs.rs/zitadel/latest/zitadel/) ![Crates.io](https://img.shields.io/crates/dv/zitadel) ![Crates.io](https://img.shields.io/crates/l/zitadel) - -This repository contains the gRPC service clients and helpers/credentials/other utilities -for [ZITADEL](https://github.com/zitadel/zitadel). - -The following features are present: -- API clients for communication with the ZITADEL API (calling gRPC methods) -- Credentials support for the API clients (access token and service account interceptors) -- OIDC Introspection support for [rocket](https://rocket.rs) -- OIDC Introspection support for [axum](https://github.com/tokio-rs/axum) - -### Example - -There exist a few examples in the `zitadel-examples` crate. -Go there to see the library in action, or head over to the -[documentation](https://docs.rs/zitadel/latest/zitadel/) to see the full API documentation. - -### Compatibility Matrix - -| ZITADEL Version | Rust Version | zitadel-rust Version | zitadel-gen Version | -|-----------------|--------------|----------------------|---------------------| -| 2.69.1 | 1.80.0+ | 5.5.2 | 2.69.1 | - -Starting from 5.5.2, the crate zitadel-gen is responsible to generate the code for the API clients. -The generated code is then used by the zitadel crate to provide a more idiomatic Rust API. -The zitadel-gen version should always be the same as the ZITADEL version (SemVer). - -#### License - - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in the package by you, as defined in the Apache-2.0 license, shall be -dual licensed as above, without any additional terms or conditions. - - -#### Thanks and Acknowledgements - -This project is supported by [Christoph Bühler from smartive.ch](https://smartive.ch) and the crates owns him 99% of the hard work. -Thanks also to all notable contributors and the ZITADEL team for their support and feedback. \ No newline at end of file diff --git a/crates/zitadel/examples/actix_webapi_oauth_interception_basic.rs b/examples/actix_webapi_oauth_interception_basic.rs similarity index 100% rename from crates/zitadel/examples/actix_webapi_oauth_interception_basic.rs rename to examples/actix_webapi_oauth_interception_basic.rs diff --git a/crates/zitadel/examples/axum_webapi_oauth_interception_basic.rs b/examples/axum_webapi_oauth_interception_basic.rs similarity index 100% rename from crates/zitadel/examples/axum_webapi_oauth_interception_basic.rs rename to examples/axum_webapi_oauth_interception_basic.rs diff --git a/crates/zitadel/examples/fetch_profile_with_pat.rs b/examples/fetch_profile_with_pat.rs similarity index 100% rename from crates/zitadel/examples/fetch_profile_with_pat.rs rename to examples/fetch_profile_with_pat.rs diff --git a/crates/zitadel/examples/fetch_profile_with_service_account.rs b/examples/fetch_profile_with_service_account.rs similarity index 100% rename from crates/zitadel/examples/fetch_profile_with_service_account.rs rename to examples/fetch_profile_with_service_account.rs diff --git a/crates/zitadel/examples/rocket_webapi_oauth_interception_basic.rs b/examples/rocket_webapi_oauth_interception_basic.rs similarity index 100% rename from crates/zitadel/examples/rocket_webapi_oauth_interception_basic.rs rename to examples/rocket_webapi_oauth_interception_basic.rs diff --git a/crates/zitadel/examples/rocket_webapi_oauth_interception_jwtprofile.rs b/examples/rocket_webapi_oauth_interception_jwtprofile.rs similarity index 100% rename from crates/zitadel/examples/rocket_webapi_oauth_interception_jwtprofile.rs rename to examples/rocket_webapi_oauth_interception_jwtprofile.rs diff --git a/crates/zitadel/examples/rocket_webapi_oauth_interception_jwtprofile_cached.rs b/examples/rocket_webapi_oauth_interception_jwtprofile_cached.rs similarity index 100% rename from crates/zitadel/examples/rocket_webapi_oauth_interception_jwtprofile_cached.rs rename to examples/rocket_webapi_oauth_interception_jwtprofile_cached.rs diff --git a/crates/zitadel/examples/service_account_authentication.rs b/examples/service_account_authentication.rs similarity index 100% rename from crates/zitadel/examples/service_account_authentication.rs rename to examples/service_account_authentication.rs diff --git a/justfile b/justfile index 8cfb7ff0..72d5d3cf 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,6 @@ -proto_dir := "./crates/zitadel-gen/src/api/" -gen_dir := "./crates/zitadel-gen" +proto_dir := "./src/api/generated" zitadel_proto_version := "v2.71.19" - default: clean generate-grpc clean: @@ -11,41 +9,5 @@ clean: generate-grpc: buf generate https://github.com/zitadel/zitadel.git#tag={{zitadel_proto_version}} --path ./proto/zitadel -build_zitadel-grpc: - cargo set-version --package zitadel-gen `echo {{zitadel_proto_version}} | sed 's/^v//'` - cargo build --package zitadel-gen --release - install-tools: - cargo install protoc-gen-prost-crate cargo-edit - -all_examples: - # fetch_profile_with_pat - cargo run -p zitadel-examples --example fetch_profile_with_pat \ - --features "zitadel/api zitadel/interceptors tokio" --release - - # fetch_profile_with_service_account - cargo run -p zitadel-examples --example fetch_profile_with_service_account \ - --features "zitadel/api zitadel/interceptors tokio" --release - - # actix_webapi_oauth_interception_basic - cargo run -p zitadel-examples --example actix_webapi_oauth_interception_basic \ - --features "actix" --release - - # axum_webapi_oauth_interception_basic - cargo run -p zitadel-examples --example axum_webapi_oauth_interception_basic \ - --features "axum" --release - - # rocket_webapi_oauth_interception_basic - cargo run -p zitadel-examples --example rocket_webapi_oauth_interception_basic \ - --features "rocket" --release - - # rocket_webapi_oauth_interception_jwtprofile_cached - cargo run -p zitadel-examples --example rocket_webapi_oauth_interception_jwtprofile_cached \ - --features "rocket zitadel/introspection_cache" --release - - # rocket_webapi_oauth_interception_jwtprofile - cargo run -p zitadel-examples --example rocket_webapi_oauth_interception_jwtprofile \ - --features "rocket" --release - - # service_account_authentication - cargo run -p zitadel-examples --example service_account_authentication --features "zitadel/credentials tokio" --release \ No newline at end of file + cargo install protoc-gen-prost-crate cargo-edit \ No newline at end of file diff --git a/crates/zitadel/src/actix/introspection/config.rs b/src/actix/introspection/config.rs similarity index 100% rename from crates/zitadel/src/actix/introspection/config.rs rename to src/actix/introspection/config.rs diff --git a/crates/zitadel/src/actix/introspection/config_builder.rs b/src/actix/introspection/config_builder.rs similarity index 100% rename from crates/zitadel/src/actix/introspection/config_builder.rs rename to src/actix/introspection/config_builder.rs diff --git a/crates/zitadel/src/actix/introspection/extractor.rs b/src/actix/introspection/extractor.rs similarity index 100% rename from crates/zitadel/src/actix/introspection/extractor.rs rename to src/actix/introspection/extractor.rs diff --git a/crates/zitadel/src/actix/introspection/mod.rs b/src/actix/introspection/mod.rs similarity index 100% rename from crates/zitadel/src/actix/introspection/mod.rs rename to src/actix/introspection/mod.rs diff --git a/crates/zitadel/src/actix/mod.rs b/src/actix/mod.rs similarity index 100% rename from crates/zitadel/src/actix/mod.rs rename to src/actix/mod.rs diff --git a/crates/zitadel/src/api/clients.rs b/src/api/clients.rs similarity index 100% rename from crates/zitadel/src/api/clients.rs rename to src/api/clients.rs diff --git a/crates/zitadel/src/api/interceptors.rs b/src/api/interceptors.rs similarity index 100% rename from crates/zitadel/src/api/interceptors.rs rename to src/api/interceptors.rs diff --git a/crates/zitadel/src/api/mod.rs b/src/api/mod.rs similarity index 90% rename from crates/zitadel/src/api/mod.rs rename to src/api/mod.rs index ec220df4..3e4ad383 100644 --- a/crates/zitadel/src/api/mod.rs +++ b/src/api/mod.rs @@ -5,9 +5,11 @@ //! Further contains interceptors that may be used to //! authenticate the clients to ZITADEL with credentials. +pub use generated::zitadel; + pub mod clients; #[allow(clippy::all)] #[cfg(feature = "api")] -pub use zitadel_gen::zitadel; +mod generated; #[cfg(feature = "interceptors")] pub mod interceptors; diff --git a/crates/zitadel/src/axum/introspection/mod.rs b/src/axum/introspection/mod.rs similarity index 100% rename from crates/zitadel/src/axum/introspection/mod.rs rename to src/axum/introspection/mod.rs diff --git a/crates/zitadel/src/axum/introspection/state.rs b/src/axum/introspection/state.rs similarity index 100% rename from crates/zitadel/src/axum/introspection/state.rs rename to src/axum/introspection/state.rs diff --git a/crates/zitadel/src/axum/introspection/state_builder.rs b/src/axum/introspection/state_builder.rs similarity index 100% rename from crates/zitadel/src/axum/introspection/state_builder.rs rename to src/axum/introspection/state_builder.rs diff --git a/crates/zitadel/src/axum/introspection/user.rs b/src/axum/introspection/user.rs similarity index 100% rename from crates/zitadel/src/axum/introspection/user.rs rename to src/axum/introspection/user.rs diff --git a/crates/zitadel/src/axum/mod.rs b/src/axum/mod.rs similarity index 100% rename from crates/zitadel/src/axum/mod.rs rename to src/axum/mod.rs diff --git a/crates/zitadel/src/credentials/application.rs b/src/credentials/application.rs similarity index 100% rename from crates/zitadel/src/credentials/application.rs rename to src/credentials/application.rs diff --git a/crates/zitadel/src/credentials/jwt.rs b/src/credentials/jwt.rs similarity index 100% rename from crates/zitadel/src/credentials/jwt.rs rename to src/credentials/jwt.rs diff --git a/crates/zitadel/src/credentials/mod.rs b/src/credentials/mod.rs similarity index 100% rename from crates/zitadel/src/credentials/mod.rs rename to src/credentials/mod.rs diff --git a/crates/zitadel/src/credentials/service_account.rs b/src/credentials/service_account.rs similarity index 100% rename from crates/zitadel/src/credentials/service_account.rs rename to src/credentials/service_account.rs diff --git a/crates/zitadel/src/lib.rs b/src/lib.rs similarity index 100% rename from crates/zitadel/src/lib.rs rename to src/lib.rs diff --git a/crates/zitadel/src/oidc/discovery.rs b/src/oidc/discovery.rs similarity index 100% rename from crates/zitadel/src/oidc/discovery.rs rename to src/oidc/discovery.rs diff --git a/crates/zitadel/src/oidc/introspection/cache/in_memory.rs b/src/oidc/introspection/cache/in_memory.rs similarity index 100% rename from crates/zitadel/src/oidc/introspection/cache/in_memory.rs rename to src/oidc/introspection/cache/in_memory.rs diff --git a/crates/zitadel/src/oidc/introspection/cache/mod.rs b/src/oidc/introspection/cache/mod.rs similarity index 100% rename from crates/zitadel/src/oidc/introspection/cache/mod.rs rename to src/oidc/introspection/cache/mod.rs diff --git a/crates/zitadel/src/oidc/introspection/mod.rs b/src/oidc/introspection/mod.rs similarity index 100% rename from crates/zitadel/src/oidc/introspection/mod.rs rename to src/oidc/introspection/mod.rs diff --git a/crates/zitadel/src/oidc/mod.rs b/src/oidc/mod.rs similarity index 100% rename from crates/zitadel/src/oidc/mod.rs rename to src/oidc/mod.rs diff --git a/crates/zitadel/src/rocket/introspection/config.rs b/src/rocket/introspection/config.rs similarity index 100% rename from crates/zitadel/src/rocket/introspection/config.rs rename to src/rocket/introspection/config.rs diff --git a/crates/zitadel/src/rocket/introspection/config_builder.rs b/src/rocket/introspection/config_builder.rs similarity index 100% rename from crates/zitadel/src/rocket/introspection/config_builder.rs rename to src/rocket/introspection/config_builder.rs diff --git a/crates/zitadel/src/rocket/introspection/guard.rs b/src/rocket/introspection/guard.rs similarity index 100% rename from crates/zitadel/src/rocket/introspection/guard.rs rename to src/rocket/introspection/guard.rs diff --git a/crates/zitadel/src/rocket/introspection/mod.rs b/src/rocket/introspection/mod.rs similarity index 100% rename from crates/zitadel/src/rocket/introspection/mod.rs rename to src/rocket/introspection/mod.rs diff --git a/crates/zitadel/src/rocket/mod.rs b/src/rocket/mod.rs similarity index 100% rename from crates/zitadel/src/rocket/mod.rs rename to src/rocket/mod.rs