Trait mas_storage::oauth2::OAuth2ClientRepository
source · pub trait OAuth2ClientRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<Client>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn load_batch<'life0, 'async_trait>(
&'life0 mut self,
ids: BTreeSet<Ulid>,
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Ulid, Client>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
redirect_uris: Vec<Url>,
encrypted_client_secret: Option<String>,
application_type: Option<ApplicationType>,
grant_types: Vec<GrantType>,
client_name: Option<String>,
logo_uri: Option<Url>,
client_uri: Option<Url>,
policy_uri: Option<Url>,
tos_uri: Option<Url>,
jwks_uri: Option<Url>,
jwks: Option<PublicJsonWebKeySet>,
id_token_signed_response_alg: Option<JsonWebSignatureAlg>,
userinfo_signed_response_alg: Option<JsonWebSignatureAlg>,
token_endpoint_auth_method: Option<OAuthClientAuthenticationMethod>,
token_endpoint_auth_signing_alg: Option<JsonWebSignatureAlg>,
initiate_login_uri: Option<Url>,
) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn upsert_static<'life0, 'async_trait>(
&'life0 mut self,
client_id: Ulid,
client_auth_method: OAuthClientAuthenticationMethod,
encrypted_client_secret: Option<String>,
jwks: Option<PublicJsonWebKeySet>,
jwks_uri: Option<Url>,
redirect_uris: Vec<Url>,
) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn all_static<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Client>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_consent_for_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
client: &'life1 Client,
user: &'life2 User,
) -> Pin<Box<dyn Future<Output = Result<Scope, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn give_consent_for_user<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user: &'life4 User,
scope: &'life5 Scope,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait;
fn delete_by_id<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn find_by_client_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Client>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn delete<'life0, 'async_trait>(
&'life0 mut self,
client: Client,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
An OAuth2ClientRepository
helps interacting with Client
saved in the
storage backend
Required Associated Types§
Required Methods§
sourcefn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lookup an OAuth2 client by its ID
Returns None
if the client does not exist
§Parameters
id
: The ID of the client to lookup
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn load_batch<'life0, 'async_trait>(
&'life0 mut self,
ids: BTreeSet<Ulid>,
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Ulid, Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_batch<'life0, 'async_trait>(
&'life0 mut self,
ids: BTreeSet<Ulid>,
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Ulid, Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load a batch of OAuth2 clients by their IDs
Returns a map of client IDs to clients. If a client does not exist, it is not present in the map.
§Parameters
ids
: The IDs of the clients to load
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
redirect_uris: Vec<Url>,
encrypted_client_secret: Option<String>,
application_type: Option<ApplicationType>,
grant_types: Vec<GrantType>,
client_name: Option<String>,
logo_uri: Option<Url>,
client_uri: Option<Url>,
policy_uri: Option<Url>,
tos_uri: Option<Url>,
jwks_uri: Option<Url>,
jwks: Option<PublicJsonWebKeySet>,
id_token_signed_response_alg: Option<JsonWebSignatureAlg>,
userinfo_signed_response_alg: Option<JsonWebSignatureAlg>,
token_endpoint_auth_method: Option<OAuthClientAuthenticationMethod>,
token_endpoint_auth_signing_alg: Option<JsonWebSignatureAlg>,
initiate_login_uri: Option<Url>,
) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
redirect_uris: Vec<Url>,
encrypted_client_secret: Option<String>,
application_type: Option<ApplicationType>,
grant_types: Vec<GrantType>,
client_name: Option<String>,
logo_uri: Option<Url>,
client_uri: Option<Url>,
policy_uri: Option<Url>,
tos_uri: Option<Url>,
jwks_uri: Option<Url>,
jwks: Option<PublicJsonWebKeySet>,
id_token_signed_response_alg: Option<JsonWebSignatureAlg>,
userinfo_signed_response_alg: Option<JsonWebSignatureAlg>,
token_endpoint_auth_method: Option<OAuthClientAuthenticationMethod>,
token_endpoint_auth_signing_alg: Option<JsonWebSignatureAlg>,
initiate_login_uri: Option<Url>,
) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Add a new OAuth2 client
Returns the client that was added
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsredirect_uris
: The list of redirect URIs used by this clientencrypted_client_secret
: The encrypted client secret, if anyapplication_type
: The application type of this clientgrant_types
: The list of grant types this client can useclient_name
: The human-readable name of this client, if givenlogo_uri
: The URI of the logo of this client, if givenclient_uri
: The URI of a website of this client, if givenpolicy_uri
: The URI of the privacy policy of this client, if giventos_uri
: The URI of the terms of service of this client, if givenjwks_uri
: The URI of the JWKS of this client, if givenjwks
: The JWKS of this client, if givenid_token_signed_response_alg
: The algorithm used to sign the ID tokenuserinfo_signed_response_alg
: The algorithm used to sign the user info. If none, the user info endpoint will not sign the responsetoken_endpoint_auth_method
: The authentication method used by this client when calling the token endpointtoken_endpoint_auth_signing_alg
: The algorithm used to sign the JWT when using theclient_secret_jwt
orprivate_key_jwt
authentication methodsinitiate_login_uri
: The URI used to initiate a login, if given
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn upsert_static<'life0, 'async_trait>(
&'life0 mut self,
client_id: Ulid,
client_auth_method: OAuthClientAuthenticationMethod,
encrypted_client_secret: Option<String>,
jwks: Option<PublicJsonWebKeySet>,
jwks_uri: Option<Url>,
redirect_uris: Vec<Url>,
) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert_static<'life0, 'async_trait>(
&'life0 mut self,
client_id: Ulid,
client_auth_method: OAuthClientAuthenticationMethod,
encrypted_client_secret: Option<String>,
jwks: Option<PublicJsonWebKeySet>,
jwks_uri: Option<Url>,
redirect_uris: Vec<Url>,
) -> Pin<Box<dyn Future<Output = Result<Client, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add or replace a static client
Returns the client that was added or replaced
§Parameters
client_id
: The client IDclient_auth_method
: The authentication method this client usesencrypted_client_secret
: The encrypted client secret, if anyjwks
: The client JWKS, if anyjwks_uri
: The client JWKS URI, if anyredirect_uris
: The list of redirect URIs used by this client
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn all_static<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn all_static<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
sourcefn get_consent_for_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
client: &'life1 Client,
user: &'life2 User,
) -> Pin<Box<dyn Future<Output = Result<Scope, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_consent_for_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
client: &'life1 Client,
user: &'life2 User,
) -> Pin<Box<dyn Future<Output = Result<Scope, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get the list of scopes that the user has given consent for the given client
§Parameters
client
: The client to get the consent foruser
: The user to get the consent for
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn give_consent_for_user<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user: &'life4 User,
scope: &'life5 Scope,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn give_consent_for_user<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user: &'life4 User,
scope: &'life5 Scope,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Give consent for a set of scopes for the given client and user
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsclient
: The client to give the consent foruser
: The user to give the consent forscope
: The scope to give consent for
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn delete_by_id<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_by_id<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a client by ID
§Parameters
id
: The ID of the client to delete
§Errors
Returns Self::Error
if the underlying repository fails, or if the
client does not exist
Provided Methods§
sourcefn find_by_client_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_client_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
client_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Client>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find an OAuth2 client by its client ID
sourcefn delete<'life0, 'async_trait>(
&'life0 mut self,
client: Client,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 mut self,
client: Client,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a client
§Parameters
client
: The client to delete
§Errors
Returns Self::Error
if the underlying repository fails, or if the
client does not exist