[][src]Struct oauth_credentials::Credentials

pub struct Credentials<T = String> {
    pub identifier: T,
    pub secret: T,
}

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]

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]

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]

Auto Trait Implementations

impl<T> RefUnwindSafe for Credentials<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Credentials<T> where
    T: Send
[src]

impl<T> Sync for Credentials<T> where
    T: Sync
[src]

impl<T> Unpin for Credentials<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Credentials<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.