pub struct ApiKeyService { /* private fields */ }Expand description
API key service for generating and validating API keys.
Implementations§
Source§impl ApiKeyService
impl ApiKeyService
Sourcepub async fn create_api_key(
&self,
tenant_id: Uuid,
req: CreateApiKeyRequest,
) -> ProxyResult<ApiKey>
pub async fn create_api_key( &self, tenant_id: Uuid, req: CreateApiKeyRequest, ) -> ProxyResult<ApiKey>
Generate a new API key for a tenant.
Returns the API key with the raw key value (only available at creation time).
Sourcepub async fn validate_api_key(
&self,
raw_key: &str,
) -> ProxyResult<ValidatedApiKey>
pub async fn validate_api_key( &self, raw_key: &str, ) -> ProxyResult<ValidatedApiKey>
Validate an API key and return the tenant ID and scopes.
Sourcepub async fn list_api_keys(&self, tenant_id: Uuid) -> ProxyResult<Vec<ApiKey>>
pub async fn list_api_keys(&self, tenant_id: Uuid) -> ProxyResult<Vec<ApiKey>>
List API keys for a tenant.
Sourcepub async fn get_api_key(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<Option<ApiKey>>
pub async fn get_api_key( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<Option<ApiKey>>
Get an API key by ID.
Sourcepub async fn revoke_api_key(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn revoke_api_key( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Revoke (delete) an API key.
Sourcepub async fn disable_api_key(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn disable_api_key( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Disable an API key without deleting it.
Sourcepub async fn enable_api_key(
&self,
id: Uuid,
tenant_id: Uuid,
) -> ProxyResult<bool>
pub async fn enable_api_key( &self, id: Uuid, tenant_id: Uuid, ) -> ProxyResult<bool>
Enable a disabled API key.
Auto Trait Implementations§
impl !RefUnwindSafe for ApiKeyService
impl !UnwindSafe for ApiKeyService
impl Freeze for ApiKeyService
impl Send for ApiKeyService
impl Sync for ApiKeyService
impl Unpin for ApiKeyService
impl UnsafeUnpin for ApiKeyService
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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 more