[−][src]Struct oauth_credentials::Credentials
An OAuth "credentials" pair defined in RFC 5849 section 1.1.
This type represents:
- Client credentials (consumer key and secret) used to authenticate as a client.
- Temporary credentials (request token and secret) which represent an authorization request.
- Token credentials (access token and secret) which represent an access grant from a resource owner to a client.
In order to make requests on behalf of a resource owner, you (the client) need a set of client credentials and token credentials, which is represented by the Token type.
In a typical authorization flow, you only have client credentials at the beginning. To obtain token credentials, you first obtain a set of temporary credentials using the client credentials. And after the resource owner approves the authorization request, you use the temporary credentials to request a set of token credentials from the server.
Fields
identifier: T
The unique identifier part of the credentials pair.
secret: T
The shared secret part of the credentials pair.
Implementations
impl<T: AsRef<str>> Credentials<T>
[src]
pub fn new(identifier: T, secret: T) -> Self
[src]
Creates a new Credentials
.
pub fn identifier(&self) -> &str
[src]
Returns the unique identifier part of the credentials pair.
pub fn secret(&self) -> &str
[src]
Returns the shared secret part of the credentials pair.
pub fn as_ref(&self) -> Credentials<&str>
[src]
Converts from &Credentials<T>
to Credentials<&str>
.
impl<T> Credentials<T>
[src]
pub fn map<U, F>(self, mut f: F) -> Credentials<U> where
F: FnMut(T) -> U,
U: AsRef<str>,
[src]
F: FnMut(T) -> U,
U: AsRef<str>,
Maps a Credentials<T>
to Credentials<U>
by applying a function to contained values.
Example
async fn get_temporary_credentials() -> Credentials { /* ... */ } let boxed: Credentials<Box<str>> = get_temporary_credentials().await.map(Into::into);
Trait Implementations
impl<T: Clone> Clone for Credentials<T>
[src]
pub fn clone(&self) -> Credentials<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for Credentials<T>
[src]
impl<T: Debug> Debug for Credentials<T>
[src]
impl<'a, T: AsRef<str>> From<&'a Credentials<T>> for Credentials<&'a str>
[src]
pub fn from(credentials: &'a Credentials<T>) -> Self
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Credentials<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Credentials<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Credentials<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Credentials<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Credentials<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,