Trait Request

Source
pub trait Request {
    // Required methods
    fn valid(&self) -> bool;
    fn token(&self) -> Option<Cow<'_, str>>;
}
Expand description

Required request methods for deciding on the rights to access a protected resource.

Required Methods§

Source

fn valid(&self) -> bool

Received request might not be encoded correctly. This method gives implementors the chance to signal that a request was received but its encoding was generally malformed. If this is the case, then no other attribute will be queried. This method exists mainly to make frontends straightforward by not having them handle special cases for malformed requests.

Source

fn token(&self) -> Option<Cow<'_, str>>

The authorization used in the request.

Expects the complete Authorization HTTP-header, including the qualification as Bearer. In case the client included multiple forms of authorization, this method MUST return None and the request SHOULD be marked as invalid.

Implementors§