pub trait Authorizer {
    // Required methods
    fn authorize(&mut self, _: Grant) -> Result<String, ()>;
    fn extract(&mut self, token: &str) -> Result<Option<Grant>, ()>;
}
Expand description

Authorizers create and manage authorization codes.

The authorization code can be traded for a bearer token at the token endpoint.

Required Methods§

source

fn authorize(&mut self, _: Grant) -> Result<String, ()>

Create a code which allows retrieval of a bearer token at a later time.

source

fn extract(&mut self, token: &str) -> Result<Option<Grant>, ()>

Retrieve the parameters associated with a token, invalidating the code in the process. In particular, a code should not be usable twice (there is no stateless implementation of an authorizer for this reason).

Implementations on Foreign Types§

source§

impl<'a, A: Authorizer + ?Sized> Authorizer for &'a mut A

source§

fn authorize(&mut self, grant: Grant) -> Result<String, ()>

source§

fn extract(&mut self, code: &str) -> Result<Option<Grant>, ()>

source§

impl<'a, A: Authorizer + ?Sized> Authorizer for RwLockWriteGuard<'a, A>

source§

fn authorize(&mut self, grant: Grant) -> Result<String, ()>

source§

fn extract(&mut self, code: &str) -> Result<Option<Grant>, ()>

source§

impl<A: Authorizer + ?Sized> Authorizer for Box<A>

source§

fn authorize(&mut self, grant: Grant) -> Result<String, ()>

source§

fn extract(&mut self, code: &str) -> Result<Option<Grant>, ()>

source§

impl<'a, A: Authorizer + ?Sized> Authorizer for MutexGuard<'a, A>

source§

fn authorize(&mut self, grant: Grant) -> Result<String, ()>

source§

fn extract(&mut self, code: &str) -> Result<Option<Grant>, ()>

Implementors§