pub struct TenantValidatingProvider<P> { /* private fields */ }Expand description
Validation wrapper that ensures tenant context is properly handled.
This wrapper validates tenant contexts and provides clear error messages when operations are performed with incorrect tenant contexts.
Implementations§
Source§impl<P> TenantValidatingProvider<P>
impl<P> TenantValidatingProvider<P>
Trait Implementations§
Source§impl<P> ResourceProvider for TenantValidatingProvider<P>
impl<P> ResourceProvider for TenantValidatingProvider<P>
Source§type Error = AdapterError<<P as ResourceProvider>::Error>
type Error = AdapterError<<P as ResourceProvider>::Error>
Error type returned by all provider operations
Source§fn create_resource(
&self,
resource_type: &str,
data: Value,
context: &RequestContext,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Send
fn create_resource( &self, resource_type: &str, data: Value, context: &RequestContext, ) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Send
Create a resource for the tenant specified in the request context. Read more
Source§fn get_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Send
fn get_resource( &self, resource_type: &str, id: &str, context: &RequestContext, ) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Send
Get a resource by ID from the tenant specified in the request context. Read more
Source§fn update_resource(
&self,
resource_type: &str,
id: &str,
data: Value,
expected_version: Option<&RawVersion>,
context: &RequestContext,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Send
fn update_resource( &self, resource_type: &str, id: &str, data: Value, expected_version: Option<&RawVersion>, context: &RequestContext, ) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Send
Update a resource in the tenant specified in the request context. Read more
Source§fn delete_resource(
&self,
resource_type: &str,
id: &str,
expected_version: Option<&RawVersion>,
context: &RequestContext,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn delete_resource( &self, resource_type: &str, id: &str, expected_version: Option<&RawVersion>, context: &RequestContext, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Delete a resource from the tenant specified in the request context. Read more
Source§fn list_resources(
&self,
resource_type: &str,
query: Option<&ListQuery>,
context: &RequestContext,
) -> impl Future<Output = Result<Vec<VersionedResource>, Self::Error>> + Send
fn list_resources( &self, resource_type: &str, query: Option<&ListQuery>, context: &RequestContext, ) -> impl Future<Output = Result<Vec<VersionedResource>, Self::Error>> + Send
List resources from the tenant specified in the request context. Read more
Source§fn find_resources_by_attribute(
&self,
resource_type: &str,
attribute_name: &str,
attribute_value: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Vec<VersionedResource>, Self::Error>> + Send
fn find_resources_by_attribute( &self, resource_type: &str, attribute_name: &str, attribute_value: &str, context: &RequestContext, ) -> impl Future<Output = Result<Vec<VersionedResource>, Self::Error>> + Send
Find resources by attribute value within the tenant specified in the request context. Read more
Source§fn patch_resource(
&self,
resource_type: &str,
id: &str,
patch_request: &Value,
expected_version: Option<&RawVersion>,
context: &RequestContext,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Send
fn patch_resource( &self, resource_type: &str, id: &str, patch_request: &Value, expected_version: Option<&RawVersion>, context: &RequestContext, ) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Send
Apply a PATCH operation to a resource. Read more
Auto Trait Implementations§
impl<P> Freeze for TenantValidatingProvider<P>where
P: Freeze,
impl<P> RefUnwindSafe for TenantValidatingProvider<P>where
P: RefUnwindSafe,
impl<P> Send for TenantValidatingProvider<P>where
P: Send,
impl<P> Sync for TenantValidatingProvider<P>where
P: Sync,
impl<P> Unpin for TenantValidatingProvider<P>where
P: Unpin,
impl<P> UnwindSafe for TenantValidatingProvider<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ConditionalOperations for Twhere
T: ResourceProvider,
impl<T> ConditionalOperations for Twhere
T: ResourceProvider,
Source§fn conditional_update_resource(
&self,
resource_type: &str,
id: &str,
data: Value,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
fn conditional_update_resource(
&self,
resource_type: &str,
id: &str,
data: Value,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
Perform a conditional update operation. Read more
Source§fn conditional_delete_resource(
&self,
resource_type: &str,
id: &str,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<()>, Self::Error>> + Sendwhere
Self: Sync,
fn conditional_delete_resource(
&self,
resource_type: &str,
id: &str,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<()>, Self::Error>> + Sendwhere
Self: Sync,
Perform a conditional delete operation. Read more
Source§fn conditional_patch_resource(
&self,
resource_type: &str,
id: &str,
patch_request: &Value,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
fn conditional_patch_resource(
&self,
resource_type: &str,
id: &str,
patch_request: &Value,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<ConditionalResult<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
Perform a conditional PATCH operation. Read more
Source§fn get_versioned_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
fn get_versioned_resource(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
Get a resource with its version information. Read more
Source§fn create_versioned_resource(
&self,
resource_type: &str,
data: Value,
context: &RequestContext,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Sendwhere
Self: Sync,
fn create_versioned_resource(
&self,
resource_type: &str,
data: Value,
context: &RequestContext,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Sendwhere
Self: Sync,
Create a resource with version information. Read more
Source§fn check_resource_version(
&self,
resource_type: &str,
id: &str,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<Option<bool>, Self::Error>> + Sendwhere
Self: Sync,
fn check_resource_version(
&self,
resource_type: &str,
id: &str,
expected_version: &RawVersion,
context: &RequestContext,
) -> impl Future<Output = Result<Option<bool>, Self::Error>> + Sendwhere
Self: Sync,
Check if a resource version matches the expected version. Read more
Source§fn get_resource_version(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<RawVersion>, Self::Error>> + Sendwhere
Self: Sync,
fn get_resource_version(
&self,
resource_type: &str,
id: &str,
context: &RequestContext,
) -> impl Future<Output = Result<Option<RawVersion>, Self::Error>> + Sendwhere
Self: Sync,
Get the current version of a resource without retrieving the full resource. Read more
Source§fn is_valid_version(&self, version: &RawVersion) -> bool
fn is_valid_version(&self, version: &RawVersion) -> bool
Validate that a version is in the expected format. Read more
Source§fn create_version_conflict(
&self,
expected: RawVersion,
current: RawVersion,
resource_info: Option<&str>,
) -> VersionConflict
fn create_version_conflict( &self, expected: RawVersion, current: RawVersion, resource_info: Option<&str>, ) -> VersionConflict
Create a version conflict error with standard messaging. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MultiTenantProvider for Twhere
T: ResourceProvider,
impl<T> MultiTenantProvider for Twhere
T: ResourceProvider,
Source§fn effective_tenant_id(&self, context: &RequestContext) -> String
fn effective_tenant_id(&self, context: &RequestContext) -> String
Get the effective tenant ID for an operation. Read more
Source§fn tenant_scoped_key(
&self,
tenant_id: &str,
resource_type: &str,
resource_id: &str,
) -> String
fn tenant_scoped_key( &self, tenant_id: &str, resource_type: &str, resource_id: &str, ) -> String
Create a tenant-scoped storage key. Read more
Source§fn tenant_scoped_prefix(&self, tenant_id: &str, resource_type: &str) -> String
fn tenant_scoped_prefix(&self, tenant_id: &str, resource_type: &str) -> String
Create a tenant-scoped prefix for listing operations. Read more
Source§fn is_valid_tenant_context(
&self,
context: &RequestContext,
require_tenant: bool,
) -> bool
fn is_valid_tenant_context( &self, context: &RequestContext, require_tenant: bool, ) -> bool
Validate that a request context is appropriate for multi-tenant operations. Read more
Source§fn extract_tenant_context<'a>(
&self,
context: &'a RequestContext,
) -> Option<&'a TenantContext>
fn extract_tenant_context<'a>( &self, context: &'a RequestContext, ) -> Option<&'a TenantContext>
Extract tenant context information from a request context. Read more
Source§fn generate_tenant_resource_id(
&self,
_tenant_id: &str,
_resource_type: &str,
) -> String
fn generate_tenant_resource_id( &self, _tenant_id: &str, _resource_type: &str, ) -> String
Generate a unique resource ID within a tenant scope. Read more
Source§fn same_tenant(
&self,
context1: &RequestContext,
context2: &RequestContext,
) -> bool
fn same_tenant( &self, context1: &RequestContext, context2: &RequestContext, ) -> bool
Check if two request contexts belong to the same tenant. Read more
Source§fn tenant_error_message(
&self,
context: &RequestContext,
base_message: &str,
) -> String
fn tenant_error_message( &self, context: &RequestContext, base_message: &str, ) -> String
Create a tenant-specific error message. Read more
Source§fn is_single_tenant_context(&self, context: &RequestContext) -> bool
fn is_single_tenant_context(&self, context: &RequestContext) -> bool
Check if the provider is operating in single-tenant mode for a context. Read more
Source§fn is_multi_tenant_context(&self, context: &RequestContext) -> bool
fn is_multi_tenant_context(&self, context: &RequestContext) -> bool
Check if the provider is operating in multi-tenant mode for a context. Read more
Source§fn get_client_id<'a>(&self, context: &'a RequestContext) -> Option<&'a str>
fn get_client_id<'a>(&self, context: &'a RequestContext) -> Option<&'a str>
Get the client ID associated with a tenant context. Read more
Source§impl<T> ResourceProviderExt for Twhere
T: ResourceProvider,
impl<T> ResourceProviderExt for Twhere
T: ResourceProvider,
Source§fn create_single_tenant(
&self,
resource_type: &str,
data: Value,
request_id: Option<String>,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Sendwhere
Self: Sync,
fn create_single_tenant(
&self,
resource_type: &str,
data: Value,
request_id: Option<String>,
) -> impl Future<Output = Result<VersionedResource, Self::Error>> + Sendwhere
Self: Sync,
Convenience method for single-tenant resource creation. Read more
Source§fn get_single_tenant(
&self,
resource_type: &str,
id: &str,
request_id: Option<String>,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
fn get_single_tenant(
&self,
resource_type: &str,
id: &str,
request_id: Option<String>,
) -> impl Future<Output = Result<Option<VersionedResource>, Self::Error>> + Sendwhere
Self: Sync,
Convenience method for single-tenant resource retrieval.
Source§impl<T> ScimValidator for Twhere
T: ResourceProvider,
impl<T> ScimValidator for Twhere
T: ResourceProvider,
Source§fn is_valid_scim_path(&self, path: &str) -> bool
fn is_valid_scim_path(&self, path: &str) -> bool
Validate if a path represents a valid SCIM attribute. Read more
Source§fn is_valid_complex_path(&self, path: &str) -> bool
fn is_valid_complex_path(&self, path: &str) -> bool
Validate a complex SCIM path (containing dots). Read more
Source§fn is_valid_simple_path(&self, attribute: &str) -> bool
fn is_valid_simple_path(&self, attribute: &str) -> bool
Validate a simple SCIM path (single attribute name). Read more
Source§fn is_multivalued_attribute(&self, attribute_name: &str) -> bool
fn is_multivalued_attribute(&self, attribute_name: &str) -> bool
Check if an attribute is multi-valued according to SCIM specifications. Read more
Source§fn is_readonly_attribute(&self, path: &str) -> bool
fn is_readonly_attribute(&self, path: &str) -> bool
Check if an attribute path refers to a readonly attribute. Read more
Source§fn is_valid_username(&self, username: &str) -> bool
fn is_valid_username(&self, username: &str) -> bool
Validate that a username meets SCIM requirements. Read more
Source§fn is_valid_external_id(&self, external_id: &str) -> bool
fn is_valid_external_id(&self, external_id: &str) -> bool
Validate an external ID format. Read more
Source§impl<T> TenantValidator for T
impl<T> TenantValidator for T
Source§fn validate_tenant_context(
&self,
expected_tenant_id: &str,
context: &RequestContext,
) -> Result<(), String>
fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>
Validate that the context has the expected tenant.
Source§fn validate_single_tenant_context(
&self,
context: &RequestContext,
) -> Result<(), String>
fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>
Validate that the context is for single-tenant operation.
Source§fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>
Extract tenant context or return error for multi-tenant operations.
Source§impl<P> ToSingleTenant<P> for Pwhere
P: ResourceProvider,
impl<P> ToSingleTenant<P> for Pwhere
P: ResourceProvider,
Source§fn to_single_tenant(self) -> TenantValidatingProvider<P>
fn to_single_tenant(self) -> TenantValidatingProvider<P>
Convert to a provider that validates single-tenant contexts.