Skip to main content

Auth

Trait Auth 

Source
pub trait Auth:
    Send
    + Sync
    + 'static {
    // Required methods
    fn providers(&self) -> BoxStream<'static, AuthEvent>;
    fn login(&self, flow: LoginFlow) -> BoxStream<'static, AuthEvent>;
    fn signup(&self, via: Option<ProviderName>) -> BoxStream<'static, AuthEvent>;
    fn whoami(&self) -> BoxStream<'static, AuthEvent>;
    fn logout(&self) -> BoxStream<'static, AuthEvent>;
    fn requires(&self, method: MethodPath) -> BoxStream<'static, AuthEvent>;
    fn roles(&self) -> BoxStream<'static, AuthEvent>;
    fn role_set(
        &self,
        role: RoleName,
        grants: Vec<GrantName>,
    ) -> BoxStream<'static, AuthEvent>;
    fn grant(
        &self,
        principal: Principal,
        role: RoleName,
        scope: ScopeName,
    ) -> BoxStream<'static, AuthEvent>;
    fn revoke(
        &self,
        principal: Principal,
        role: Option<RoleName>,
        scope: ScopeName,
    ) -> BoxStream<'static, AuthEvent>;
    fn waiting(&self) -> BoxStream<'static, AuthEvent>;
}
Expand description

Sign in, who am I, what does this need

Emitted by #[plexus_macros::activation] (MACRO-13) from the activation’s wire methods: implemented by the activation and by its client, so anything that implements it can be served and anything served can be called through it.

Required Methods§

Source

fn providers(&self) -> BoxStream<'static, AuthEvent>

The ways in this server offers

Source

fn login(&self, flow: LoginFlow) -> BoxStream<'static, AuthEvent>

Sign in — a person through the browser, an agent with its key

Source

fn signup(&self, via: Option<ProviderName>) -> BoxStream<'static, AuthEvent>

Create an account, or ask for access

Source

fn whoami(&self) -> BoxStream<'static, AuthEvent>

Who you are: principal, roles held where, ceiling

Source

fn logout(&self) -> BoxStream<'static, AuthEvent>

Sign out: end this session

Source

fn requires(&self, method: MethodPath) -> BoxStream<'static, AuthEvent>

What a method needs: its grant, target, and the roles that list it

Source

fn roles(&self) -> BoxStream<'static, AuthEvent>

Every role and the grants it lists

Source

fn role_set( &self, role: RoleName, grants: Vec<GrantName>, ) -> BoxStream<'static, AuthEvent>

Set a role’s grants (admin on *)

Source

fn grant( &self, principal: Principal, role: RoleName, scope: ScopeName, ) -> BoxStream<'static, AuthEvent>

Give a principal a role on a scope

Source

fn revoke( &self, principal: Principal, role: Option<RoleName>, scope: ScopeName, ) -> BoxStream<'static, AuthEvent>

Take a principal’s role on a scope away

Source

fn waiting(&self) -> BoxStream<'static, AuthEvent>

Who asked for access and holds nothing yet (admin on *)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> Auth for AuthClient<T>
where T: Transport + Clone + Send + Sync + 'static,