Skip to main content

IdentityProviderAdapter

Trait IdentityProviderAdapter 

Source
pub trait IdentityProviderAdapter:
    Debug
    + Send
    + Sync {
Show 23 methods // Required methods fn create_identity<'life0, 'life1, 'async_trait>( &'life0 self, opts: CreateIdentityOptions<'life1>, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn read_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<Option<Identity>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn read_identity_by_email<'life0, 'life1, 'async_trait>( &'life0 self, email: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<Option<Identity>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, opts: UpdateIdentityOptions, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn update_identity_address<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, address: &'life3 str, address_type: AddressType, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn delete_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn list_identities<'life0, 'async_trait>( &'life0 self, opts: ListIdentityOptions, ) -> Pin<Box<dyn Future<Output = ClResult<Vec<Identity>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn cleanup_expired_identities<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClResult<u32>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn renew_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, new_expires_at: Timestamp, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn create_api_key<'life0, 'life1, 'async_trait>( &'life0 self, opts: CreateApiKeyOptions<'life1>, ) -> Pin<Box<dyn Future<Output = ClResult<CreatedApiKey>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn verify_api_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<Option<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_api_keys<'life0, 'async_trait>( &'life0 self, opts: ListApiKeyOptions, ) -> Pin<Box<dyn Future<Output = ClResult<Vec<ApiKey>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_api_key<'life0, 'async_trait>( &'life0 self, id: i32, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn delete_api_key_for_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: i32, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn cleanup_expired_api_keys<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClResult<u32>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_identities_by_registrar<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = ClResult<Vec<Identity>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_quota_limits<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, max_identities: i32, max_storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn check_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn increment_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn decrement_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_quota_on_status_change<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, old_status: IdentityStatus, new_status: IdentityStatus, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn identity_exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... }
}
Expand description

A Cloudillo identity provider adapter

Every IdentityProviderAdapter implementation is required to implement this trait. An IdentityProviderAdapter is responsible for managing identity registrations and handling DNS modifications for identity registration.

Required Methods§

Source

fn create_identity<'life0, 'life1, 'async_trait>( &'life0 self, opts: CreateIdentityOptions<'life1>, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a new identity registration

This method registers a new identity with the given id_tag and email address. It should also handle any necessary DNS modifications for the identity.

§Arguments
  • opts - Options containing id_tag, email, and optional expiration
§Returns

The newly created Identity with all timestamps populated

§Errors

Returns an error if:

  • The id_tag already exists
  • The email is invalid or already in use
  • DNS modifications fail
Source

fn read_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<Option<Identity>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Reads an identity by its id_tag

§Arguments
  • id_tag - The unique identifier tag to look up
§Returns

Some(Identity) if found, None otherwise

Source

fn read_identity_by_email<'life0, 'life1, 'async_trait>( &'life0 self, email: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<Option<Identity>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads an identity by its email address

§Arguments
  • email - The email address to look up
§Returns

Some(Identity) if found, None otherwise

Source

fn update_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, opts: UpdateIdentityOptions, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates an existing identity

§Arguments
  • id_tag - The identifier of the identity to update
  • opts - Options containing fields to update
§Errors

Returns an error if the identity doesn’t exist or the update fails

Source

fn update_identity_address<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, address: &'life3 str, address_type: AddressType, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Updates only the address of an identity (optimized for performance)

This method is optimized for updating just the address and address type, avoiding unnecessary updates to other fields. Useful for frequent address updates.

§Arguments
  • id_tag - The identifier of the identity to update
  • address - The new address to set
  • address_type - The type of the address (IPv4, IPv6, or Hostname)
§Returns

The updated Identity with the new address

§Errors

Returns an error if the identity doesn’t exist or the update fails

Source

fn delete_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes an identity and cleans up associated DNS records

§Arguments
  • id_tag - The identifier of the identity to delete
§Errors

Returns an error if the identity doesn’t exist or DNS cleanup fails

Source

fn list_identities<'life0, 'async_trait>( &'life0 self, opts: ListIdentityOptions, ) -> Pin<Box<dyn Future<Output = ClResult<Vec<Identity>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists identities matching the given criteria

§Arguments
  • opts - Filtering and pagination options
§Returns

A vector of matching identities

Source

fn cleanup_expired_identities<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cleans up expired identities

This method should be called periodically to remove identities that have expired. It should also clean up any associated DNS records.

§Returns

The number of identities that were cleaned up

Source

fn renew_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, new_expires_at: Timestamp, ) -> Pin<Box<dyn Future<Output = ClResult<Identity>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Renews an identity’s expiration timestamp

§Arguments
  • id_tag - The identifier of the identity to renew
  • new_expires_at - The new expiration timestamp
§Errors

Returns an error if the identity doesn’t exist

Source

fn create_api_key<'life0, 'life1, 'async_trait>( &'life0 self, opts: CreateApiKeyOptions<'life1>, ) -> Pin<Box<dyn Future<Output = ClResult<CreatedApiKey>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Creates a new API key for an identity

Returns the created API key with the plaintext key (shown only once)

Source

fn verify_api_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verifies an API key and returns the associated identity if valid

Returns None if the key is invalid or expired Updates the last_used_at timestamp on successful verification

§Security Note

Implementations MUST reject identities with the prefix ‘cl-o’ as it is reserved and should not be allowed to authenticate via API keys.

Source

fn list_api_keys<'life0, 'async_trait>( &'life0 self, opts: ListApiKeyOptions, ) -> Pin<Box<dyn Future<Output = ClResult<Vec<ApiKey>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists API keys with optional filtering

Note: Only returns metadata, not the actual keys

Source

fn delete_api_key<'life0, 'async_trait>( &'life0 self, id: i32, ) -> Pin<Box<dyn Future<Output = ClResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deletes an API key by ID

Source

fn delete_api_key_for_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: i32, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Deletes an API key by ID, ensuring it belongs to the specified identity

Returns true if a key was deleted, false if no matching key was found

Source

fn cleanup_expired_api_keys<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ClResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Cleans up expired API keys

Returns the number of keys deleted

Source

fn list_identities_by_registrar<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, limit: Option<u32>, offset: Option<u32>, ) -> Pin<Box<dyn Future<Output = ClResult<Vec<Identity>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Lists identities registered by a specific registrar

§Arguments
  • registrar_id_tag - The registrar’s id_tag
  • limit - Optional limit on results
  • offset - Optional pagination offset
§Returns

A vector of identities created by this registrar

Source

fn get_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the quota for a specific registrar

§Arguments
  • registrar_id_tag - The registrar’s id_tag
§Returns

The quota information, or an error if not found

Source

fn set_quota_limits<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, max_identities: i32, max_storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sets quota limits for a registrar

§Arguments
  • registrar_id_tag - The registrar’s id_tag
  • max_identities - Maximum number of identities allowed
  • max_storage_bytes - Maximum storage in bytes
§Errors

Returns an error if the quota doesn’t exist or update fails

Source

fn check_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if a registrar has quota available for a new identity

§Arguments
  • registrar_id_tag - The registrar’s id_tag
  • storage_bytes - Storage required for the new identity
§Returns

true if quota is available, false otherwise

Source

fn increment_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Increments the quota usage for a registrar

§Arguments
  • registrar_id_tag - The registrar’s id_tag
  • storage_bytes - Storage bytes to add
§Errors

Returns an error if the quota doesn’t exist or update fails

Source

fn decrement_quota<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, storage_bytes: i64, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decrements the quota usage for a registrar

§Arguments
  • registrar_id_tag - The registrar’s id_tag
  • storage_bytes - Storage bytes to subtract
§Errors

Returns an error if the quota doesn’t exist or update fails

Source

fn update_quota_on_status_change<'life0, 'life1, 'async_trait>( &'life0 self, registrar_id_tag: &'life1 str, old_status: IdentityStatus, new_status: IdentityStatus, ) -> Pin<Box<dyn Future<Output = ClResult<RegistrarQuota>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Updates quota counts when an identity changes status

Used when an identity is activated, suspended, or deleted to adjust quota tracking.

§Arguments
  • registrar_id_tag - The registrar’s id_tag
  • old_status - The identity’s previous status
  • new_status - The identity’s new status
§Errors

Returns an error if the quota doesn’t exist or update fails

Provided Methods§

Source

fn identity_exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id_tag_prefix: &'life1 str, id_tag_domain: &'life2 str, ) -> Pin<Box<dyn Future<Output = ClResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Checks if an identity exists

§Arguments
  • id_tag - The identifier to check
§Returns

true if the identity exists, false otherwise

Implementors§