Trait IAuthService

Source
pub trait IAuthService: RustiumService {
    // Required method
    fn get_claim_user<'life0, 'async_trait>(
        &'life0 self,
        token_claim: Claims,
    ) -> Pin<Box<dyn Future<Output = RustiumResult<Box<dyn AuthUser>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

EXAMPLE

struct User {}
impl AuthUser for User {
    fn get_id(&self) -> String {
        todo!()
    }
    fn get_username(&self) -> String {
        todo!()
    }
    fn is_admin(&self) -> bool {
        todo!()
    }
}
#[injectable(IAuthService)]
struct ExampleAuthService;
impl RustiumService for ExampleAuthService {}
#[async_trait]
impl IAuthService for ExampleAuthService {
    async fn get_claim_user(&self, token_claim: Claims) -> RustiumResult<Box<dyn AuthUser>> {
        todo!()
    }
}

Required Methods§

Source

fn get_claim_user<'life0, 'async_trait>( &'life0 self, token_claim: Claims, ) -> Pin<Box<dyn Future<Output = RustiumResult<Box<dyn AuthUser>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§