pub trait AuthorizationTrait: Sync + Send + 'static {
    // Required methods
    fn get_token_from_access_token<'async_trait>(
        access_token: String,
        figment: Figment
    ) -> Pin<Box<dyn Future<Output = Result<Token, TokenError>> + Send + 'async_trait>>;
    fn get_user_from_token<'async_trait>(
        token: Token,
        figment: Figment
    ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, TokenError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

AuthorizationTrait is a trait that should be implemented by your User entity. This trait, in conjunction with the ncryptf::auth!() macro, enables individual Users to be returned as part of a Rocket request guard.

Required Methods§

source

fn get_token_from_access_token<'async_trait>( access_token: String, figment: Figment ) -> Pin<Box<dyn Future<Output = Result<Token, TokenError>> + Send + 'async_trait>>

Returns a ncryptf::Token instance given an access_token. The databases.* figment is provided to construct the relevant database connections as needed to process this request.

source

fn get_user_from_token<'async_trait>( token: Token, figment: Figment ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, TokenError>> + Send + 'async_trait>>
where Self: 'async_trait,

Returns a (User) entity given a specific token You can use this method to determine the appropriate access credentials, scoping, and permissions. The databases.* figment is provided to construct the relevant database connections as needed to process this request.

Object Safety§

This trait is not object safe.

Implementors§