pub struct OAuthUserClientScopes {
pub id: Uuid,
pub user_id: Uuid,
pub client_id: Uuid,
pub scopes: Vec<String>,
pub granted_at: DateTime<Utc>,
}Expand description
A user’s grant to a client: the scopes they consented to.
Fields§
§id: Uuid§user_id: Uuid§client_id: Uuid§scopes: Vec<String>§granted_at: DateTime<Utc>Implementations§
Source§impl OAuthUserClientScopes
impl OAuthUserClientScopes
pub async fn insert( conn: &mut PgConnection, user_id: Uuid, client_id: Uuid, scopes: &[String], ) -> ModelResult<()>
Sourcepub async fn find_grant(
conn: &mut PgConnection,
user_id: Uuid,
client_id: Uuid,
) -> ModelResult<Option<OAuthUserClientScopes>>
pub async fn find_grant( conn: &mut PgConnection, user_id: Uuid, client_id: Uuid, ) -> ModelResult<Option<OAuthUserClientScopes>>
The user’s grant to the client, if any.
Sourcepub async fn find_scopes(
conn: &mut PgConnection,
user_id: Uuid,
client_id: Uuid,
) -> ModelResult<Vec<String>>
pub async fn find_scopes( conn: &mut PgConnection, user_id: Uuid, client_id: Uuid, ) -> ModelResult<Vec<String>>
The scopes the user has granted to the client; none without a grant.
Sourcepub async fn revoke_user_client_everything(
conn: &mut PgConnection,
user_id: Uuid,
client_id: Uuid,
) -> ModelResult<Vec<Digest>>
pub async fn revoke_user_client_everything( conn: &mut PgConnection, user_id: Uuid, client_id: Uuid, ) -> ModelResult<Vec<Digest>>
One-shot revoke: remove all scopes and tokens for a (user, client) pair atomically.
Returns the digests of the deleted access tokens so the caller can evict their cached user mappings; without that they keep authenticating until the cache TTL.
Sourcepub async fn get_grants_for_user(
conn: &mut PgConnection,
user_id: Uuid,
) -> ModelResult<Vec<OAuthGrant>>
pub async fn get_grants_for_user( conn: &mut PgConnection, user_id: Uuid, ) -> ModelResult<Vec<OAuthGrant>>
The user’s grants, most recently used first.
Sourcepub async fn mark_grant_used(
conn: &mut PgConnection,
grant_id: Uuid,
last_used_at: Option<DateTime<Utc>>,
) -> ModelResult<()>
pub async fn mark_grant_used( conn: &mut PgConnection, grant_id: Uuid, last_used_at: Option<DateTime<Utc>>, ) -> ModelResult<()>
Records that a token of the grant was used, at most once a minute per grant. last_used_at
is the grant’s value read with the token; while it is recent, no query is sent.
Sourcepub async fn revoke_grant_by_id(
conn: &mut PgConnection,
user_id: Uuid,
grant_id: Uuid,
) -> ModelResult<Vec<Digest>>
pub async fn revoke_grant_by_id( conn: &mut PgConnection, user_id: Uuid, grant_id: Uuid, ) -> ModelResult<Vec<Digest>>
Revokes one of the user’s grants with all its tokens. Errors with RecordNotFound if the
grant is not the user’s. Returns the deleted access-token digests for cache eviction.
Trait Implementations§
Source§impl Clone for OAuthUserClientScopes
impl Clone for OAuthUserClientScopes
Source§fn clone(&self) -> OAuthUserClientScopes
fn clone(&self) -> OAuthUserClientScopes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OAuthUserClientScopes
impl Debug for OAuthUserClientScopes
Source§impl<'de> Deserialize<'de> for OAuthUserClientScopes
impl<'de> Deserialize<'de> for OAuthUserClientScopes
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a, R: Row> FromRow<'a, R> for OAuthUserClientScopes
impl<'a, R: Row> FromRow<'a, R> for OAuthUserClientScopes
Source§impl PartialEq for OAuthUserClientScopes
impl PartialEq for OAuthUserClientScopes
Source§impl Serialize for OAuthUserClientScopes
impl Serialize for OAuthUserClientScopes
impl StructuralPartialEq for OAuthUserClientScopes
Auto Trait Implementations§
impl Freeze for OAuthUserClientScopes
impl RefUnwindSafe for OAuthUserClientScopes
impl Send for OAuthUserClientScopes
impl Sync for OAuthUserClientScopes
impl Unpin for OAuthUserClientScopes
impl UnsafeUnpin for OAuthUserClientScopes
impl UnwindSafe for OAuthUserClientScopes
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].