[−][src]Struct oauth2_noserver_rs::Config
Stores the configuration for an OAuth2 client.
Methods
impl Config
[src]
pub fn new<I, S, A, T>(
client_id: I,
client_secret: S,
auth_url: A,
token_url: T
) -> Config where
A: AsRef<str>,
I: Into<String>,
S: Into<String>,
T: AsRef<str>,
[src]
client_id: I,
client_secret: S,
auth_url: A,
token_url: T
) -> Config where
A: AsRef<str>,
I: Into<String>,
S: Into<String>,
T: AsRef<str>,
Initializes the OAuth2 client with the client ID, client secret, the base authorization URL and the URL ment for requesting the access token.
pub fn add_scope<S>(self, scope: S) -> Config where
S: Into<String>,
[src]
S: Into<String>,
Appends a new scope to the authorization URL.
pub fn set_response_type<R>(self, response_type: R) -> Config where
R: Into<ResponseType>,
[src]
R: Into<ResponseType>,
Allows setting a particular response type. Both &str
and ResponseType
work here.
The default response type is code.
pub fn set_auth_type(self, auth_type: AuthType) -> Config
[src]
Allows configuring whether basic auth is used to communicate with the authorization server.
The default auth type is to place the client_id and client_secret inside the request body.
pub fn set_redirect_url<R>(self, redirect_url: R) -> Config where
R: Into<String>,
[src]
R: Into<String>,
Allows setting the redirect URL.
pub fn set_state<S>(self, state: S) -> Config where
S: Into<String>,
[src]
S: Into<String>,
Allows setting a state parameter inside the authorization URL, which we'll be returned by the server after the authorization is over.
pub fn authorize_url(&self) -> Url
[src]
Produces the full authorization URL.
pub fn exchange<C>(&self, code: C) -> Result<Token, TokenError> where
C: Into<String>,
[src]
C: Into<String>,
please use exchange_code
instead
Exchanges a code produced by a successful authorization process with an access token.
See https://tools.ietf.org/html/rfc6749#section-4.1.3
pub fn exchange_code<C>(&self, code: C) -> Result<Token, TokenError> where
C: Into<String>,
[src]
C: Into<String>,
Exchanges a code produced by a successful authorization process with an access token.
See https://tools.ietf.org/html/rfc6749#section-4.1.3
pub fn exchange_client_credentials(&self) -> Result<Token, TokenError>
[src]
Requests an access token for the client credentials grant type.
See https://tools.ietf.org/html/rfc6749#section-4.4.2
pub fn exchange_password<U, P>(
&self,
username: U,
password: P
) -> Result<Token, TokenError> where
P: Into<String>,
U: Into<String>,
[src]
&self,
username: U,
password: P
) -> Result<Token, TokenError> where
P: Into<String>,
U: Into<String>,
Requests an access token for the password grant type.
See https://tools.ietf.org/html/rfc6749#section-4.3.2
pub fn exchange_refresh_token<T>(&self, token: T) -> Result<Token, TokenError> where
T: Into<String>,
[src]
T: Into<String>,
Exchanges a refresh token for an access token
See https://tools.ietf.org/html/rfc6749#section-6
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,