Trait oauth2::client::Client [] [src]

pub trait Client<E: UserError> {
    fn get_client_data<'a>(&'a self) -> &'a ClientData;
    fn store_nonce(&mut self, token: String);
    fn consume_nonce(&mut self, token: String) -> bool;
    fn get_redirect_uri<'a>(&'a self) -> &'a str;

    fn generate_nonce(&mut self) -> String { ... }
    fn start_oauth(&mut self, scope: Option<String>, authz_request_url: Url, response: Response) { ... }
    fn handle_redirect_url(&mut self, request: Request, authz_token_url: Url) -> Result<Result<TokenData, AuthzError>, OAuthError<E>> { ... }
}

Required Methods

fn get_client_data<'a>(&'a self) -> &'a ClientData

Get own client data

fn store_nonce(&mut self, token: String)

Store a nonce, used to prevent cross-site reqeuest forgery.

fn consume_nonce(&mut self, token: String) -> bool

Consume the nonce from storage, and return true if it was found, false if no such nonce existed.

fn get_redirect_uri<'a>(&'a self) -> &'a str

Get the redirect URI for this client

Provided Methods

fn generate_nonce(&mut self) -> String

fn start_oauth(&mut self, scope: Option<String>, authz_request_url: Url, response: Response)

This is the starting point for the OAuth sequence. It redirects the user-agent to the AuthzServer's authz_request endpoint

fn handle_redirect_url(&mut self, request: Request, authz_token_url: Url) -> Result<Result<TokenData, AuthzError>, OAuthError<E>>

Handle an HTTP request to the Redirect URL (from the user-agent)

Refer to rfc6749 section 3.1.2 as to the requirements of this endpoint (absolute URI, MUST NOT include fragment, MAY include query, SHOULD use TLS)

Implementors