Skip to content

Commit

Permalink
renamed to authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Nov 4, 2024
1 parent c67d25f commit 94b575a
Show file tree
Hide file tree
Showing 34 changed files with 323 additions and 211 deletions.
10 changes: 5 additions & 5 deletions quickwit/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions quickwit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
resolver = "2"
members = [
"quickwit-actors",
"quickwit-auth",
"quickwit-authorize",
"quickwit-aws",
"quickwit-cli",
"quickwit-cluster",
Expand Down Expand Up @@ -42,7 +42,7 @@ members = [
# from the default member to ease build/deps.
default-members = [
"quickwit-actors",
"quickwit-auth",
"quickwit-authorize",
"quickwit-aws",
"quickwit-cli",
"quickwit-cluster",
Expand Down Expand Up @@ -305,7 +305,7 @@ opendal = { version = "0.44", default-features = false }
reqsign = { version = "0.14", default-features = false }

quickwit-actors = { path = "quickwit-actors" }
quickwit-auth = { path = "quickwit-auth" }
quickwit-authorize = { path = "quickwit-authorize" }
quickwit-aws = { path = "quickwit-aws" }
quickwit-cli = { path = "quickwit-cli" }
quickwit-cluster = { path = "quickwit-cluster" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "quickwit-auth"
name = "quickwit-authorize"
version.workspace = true
edition.workspace = true
homepage.workspace = true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions quickwit/quickwit-codegen/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tower = { workspace = true }
utoipa = { workspace = true }

quickwit-actors = { workspace = true }
quickwit-auth = { workspace = true }
quickwit-authorize = { workspace = true }
quickwit-common = { workspace = true }
quickwit-proto = { workspace = true }

Expand All @@ -41,4 +41,4 @@ quickwit-codegen = { workspace = true }

[features]
testsuite = ["mockall"]
enterprise = [ "quickwit-auth/enterprise" ]
enterprise = [ "quickwit-authorize/enterprise" ]
10 changes: 5 additions & 5 deletions quickwit/quickwit-codegen/example/src/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

use quickwit_auth::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization};
use quickwit_authorize::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization};

use crate::{GoodbyeRequest, HelloRequest, PingRequest};

impl Authorization for HelloRequest {
fn attenuate(
&self,
auth_token: quickwit_auth::AuthorizationToken,
) -> Result<quickwit_auth::AuthorizationToken, AuthorizationError> {
auth_token: AuthorizationToken,
) -> Result<AuthorizationToken, AuthorizationError> {
Ok(auth_token)
}
}

impl Authorization for GoodbyeRequest {
fn attenuate(
&self,
auth_token: quickwit_auth::AuthorizationToken,
auth_token: AuthorizationToken,
) -> Result<AuthorizationToken, AuthorizationError> {
Ok(auth_token)
}
}

impl StreamAuthorization for PingRequest {
fn attenuate(
auth_token: quickwit_auth::AuthorizationToken,
auth_token: AuthorizationToken,
) -> Result<AuthorizationToken, AuthorizationError> {
Ok(auth_token)
}
Expand Down
22 changes: 13 additions & 9 deletions quickwit/quickwit-codegen/example/src/codegen/hello.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quickwit/quickwit-codegen/example/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use std::fmt;

use quickwit_actors::AskError;
use quickwit_auth::AuthorizationError;
use quickwit_authorize::AuthorizationError;
use quickwit_proto::error::GrpcServiceError;
pub use quickwit_proto::error::{grpc_error_to_grpc_status, grpc_status_to_service_error};
use quickwit_proto::{ServiceError, ServiceErrorCode};
Expand Down
8 changes: 4 additions & 4 deletions quickwit/quickwit-codegen/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ fn generate_grpc_client_adapter_methods(context: &CodegenContext) -> TokenStream
let method = if syn_method.client_streaming {
quote! {
async fn #method_name(&self, request: #request_type) -> #result_type<#response_type> {
let tonic_request = quickwit_auth::build_tonic_stream_request_with_auth_token(request)?;
let tonic_request = quickwit_authorize::build_tonic_stream_request_with_auth_token(request)?;
self.inner
.clone()
.#method_name(tonic_request)
Expand All @@ -1182,7 +1182,7 @@ fn generate_grpc_client_adapter_methods(context: &CodegenContext) -> TokenStream
} else {
quote! {
async fn #method_name(&self, request: #request_type) -> #result_type<#response_type> {
let tonic_request = quickwit_auth::build_tonic_request_with_auth_token(request)?;
let tonic_request = quickwit_authorize::build_tonic_request_with_auth_token(request)?;
self.inner
.clone()
.#method_name(tonic_request)
Expand Down Expand Up @@ -1273,8 +1273,8 @@ fn generate_grpc_server_adapter_methods(context: &CodegenContext) -> TokenStream
#associated_type

async fn #method_name(&self, request: tonic::Request<#request_type>) -> Result<tonic::Response<#response_type>, tonic::Status> {
let auth_token = quickwit_auth::get_auth_token(request.metadata())?;
quickwit_auth::execute_with_authorization(auth_token, self.inner.0.#method_name(#method_arg)).await
let auth_token = quickwit_authorize::get_auth_token(request.metadata())?;
quickwit_authorize::execute_with_authorization(auth_token, self.inner.0.#method_name(#method_arg)).await
.map(#into_response_type)
.map_err(crate::error::grpc_error_to_grpc_status)
}
Expand Down
4 changes: 2 additions & 2 deletions quickwit/quickwit-ingest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ulid = { workspace = true }
utoipa = { workspace = true }

quickwit-actors = { workspace = true }
quickwit-auth = { workspace = true }
quickwit-authorize = { workspace = true }
quickwit-cluster = { workspace = true }
quickwit-common = { workspace = true, features = ["testsuite"] }
quickwit-config = { workspace = true }
Expand All @@ -63,4 +63,4 @@ quickwit-codegen = { workspace = true }
failpoints = ["fail/failpoints"]
no-failpoints = []
testsuite = ["mockall"]
enterprise = ["quickwit-auth/enterprise"]
enterprise = ["quickwit-authorize/enterprise"]
2 changes: 1 addition & 1 deletion quickwit/quickwit-ingest/src/authorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

use quickwit_auth::{Authorization, AuthorizationError, AuthorizationToken};
use quickwit_authorize::::{Authorization, AuthorizationError, AuthorizationToken};

use crate::{FetchRequest, IngestRequest, TailRequest};

Expand Down
24 changes: 15 additions & 9 deletions quickwit/quickwit-ingest/src/codegen/ingest_service.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quickwit/quickwit-ingest/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::io;

use mrecordlog::error::*;
use quickwit_actors::AskError;
use quickwit_auth::AuthorizationError;
use quickwit_authorize::AuthorizationError;
use quickwit_common::rate_limited_error;
use quickwit_common::tower::BufferError;
pub(crate) use quickwit_proto::error::{grpc_error_to_grpc_status, grpc_status_to_service_error};
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-metastore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tracing = { workspace = true }
ulid = { workspace = true, features = ["serde"] }
utoipa = { workspace = true }

quickwit-auth = { workspace = true }
quickwit-authorize = { workspace = true }
quickwit-common = { workspace = true }
quickwit-config = { workspace = true }
quickwit-doc-mapper = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-metastore/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ pub enum MetastoreResolverError {

/// The requested operation is not authorized.
#[error("unauthorized: `{0}`")]
Unauthorized(#[from] quickwit_auth::AuthorizationError),
Unauthorized(#[from] quickwit_authorize::AuthorizationError),
}
4 changes: 2 additions & 2 deletions quickwit/quickwit-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ utoipa = { workspace = true }
zstd = { workspace = true }

quickwit-actors = { workspace = true }
quickwit-auth = { workspace = true }
quickwit-authorize = { workspace = true }
quickwit-common = { workspace = true }

[dev-dependencies]
Expand All @@ -53,4 +53,4 @@ quickwit-codegen = { workspace = true }
[features]
postgres = ["sea-query", "sqlx"]
testsuite = ["mockall", "futures"]
enterprise = [ "quickwit-auth/enterprise"]
enterprise = [ "quickwit-authorize/enterprise"]
2 changes: 1 addition & 1 deletion quickwit/quickwit-proto/src/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::time::{Duration, SystemTime};

use biscuit_auth::builder_ext::BuilderExt;
use biscuit_auth::macros::*;
use quickwit_auth::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization};
use quickwit_authorize::::{Authorization, AuthorizationError, AuthorizationToken, StreamAuthorization};

use crate::cluster::FetchClusterStateRequest;
use crate::control_plane::{AdviseResetShardsRequest, GetOrCreateOpenShardsRequest};
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-proto/src/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum ClusterError {
#[error("service unavailable: {0}")]
Unavailable(String),
#[error("unauthorized: {0}")]
Unauthorized(#[from] quickwit_auth::AuthorizationError),
Unauthorized(#[from] quickwit_authorize::AuthorizationError),
}

impl ServiceError for ClusterError {
Expand Down
Loading

0 comments on commit 94b575a

Please sign in to comment.