Skip to main content

Authenticatable

Derive Macro Authenticatable 

Source
#[derive(Authenticatable)]
{
    // Attributes available to this derive:
    #[auth]
}
Expand description

Derive the Authenticatable trait so Auth::user_as::<T>() works.

Generates auth_identifier (self.id as i64), auth_identifier_name, and as_any for a struct with an integer id field. Override the field with #[auth(id = "user_id")].

#[derive(Clone, DeriveEntityModel, Authenticatable)]
pub struct Model { #[sea_orm(primary_key)] pub id: i32, /* … */ }