Struct oauth1_request::serializer::auth::Authorizer
source · [−]pub struct Authorizer<'a, SM: SignatureMethod, W = String> { /* private fields */ }
Expand description
A Serializer
that signs a request and produces OAuth 1.0 oauth_*
parameter values.
The resulting parameter values are either written to an HTTP Authorization
header value or
URI query/x-www-form-urlencoded
string (along with the other request parameters)
depending on the constructor you use.
Implementations
sourceimpl<'a, SM: SignatureMethod> Authorizer<'a, SM>
impl<'a, SM: SignatureMethod> Authorizer<'a, SM>
Available on crate feature alloc
only.
alloc
only.Creates an Authorizer
that produces an HTTP `Authorization header value.
uri
must not contain a query part.
Otherwise, the serializer will produce a wrong signature.
Panics
In debug builds, panics if uri
contains a '?'
character.
sourcepub fn form<T: Display>(
method: &str,
uri: T,
client: Credentials<&'a str>,
token: Option<Credentials<&'a str>>,
options: &'a Options<'a>,
signature_method: SM
) -> Self
Available on crate feature alloc
only.
pub fn form<T: Display>(
method: &str,
uri: T,
client: Credentials<&'a str>,
token: Option<Credentials<&'a str>>,
options: &'a Options<'a>,
signature_method: SM
) -> Self
alloc
only.Creates an Authorizer
that produces an x-www-form-urlencoded
string.
uri
must not contain a query part.
Otherwise, the serializer will produce a wrong signature.
Panics
In debug builds, panics if uri
contains a '?'
character.
sourceimpl<'a, SM: SignatureMethod, W: Write> Authorizer<'a, SM, W>
impl<'a, SM: SignatureMethod, W: Write> Authorizer<'a, SM, W>
sourcepub fn query(
method: &str,
uri: W,
client: Credentials<&'a str>,
token: Option<Credentials<&'a str>>,
options: &'a Options<'a>,
signature_method: SM
) -> Self where
W: Display,
pub fn query(
method: &str,
uri: W,
client: Credentials<&'a str>,
token: Option<Credentials<&'a str>>,
options: &'a Options<'a>,
signature_method: SM
) -> Self where
W: Display,
Creates an Authorizer
that appends a query part to uri
.
uri
must not contain a query part.
Otherwise, the serializer will produce a wrong signature.
Panics
In debug builds, panics if uri
contains a '?'
character.
Same as authorization
except that this writes the resulting Authorization
header value
into buf
.
sourcepub fn form_with_buf<T: Display>(
buf: W,
method: &str,
uri: T,
client: Credentials<&'a str>,
token: Option<Credentials<&'a str>>,
options: &'a Options<'a>,
signature_method: SM
) -> Self
pub fn form_with_buf<T: Display>(
buf: W,
method: &str,
uri: T,
client: Credentials<&'a str>,
token: Option<Credentials<&'a str>>,
options: &'a Options<'a>,
signature_method: SM
) -> Self
Same with form
except that this writes the resulting form string into buf
.
Trait Implementations
sourceimpl<'a, SM: Clone + SignatureMethod, W: Clone> Clone for Authorizer<'a, SM, W> where
SM::Sign: Clone,
impl<'a, SM: Clone + SignatureMethod, W: Clone> Clone for Authorizer<'a, SM, W> where
SM::Sign: Clone,
sourcefn clone(&self) -> Authorizer<'a, SM, W>
fn clone(&self) -> Authorizer<'a, SM, W>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a, SM: Debug + SignatureMethod, W: Debug> Debug for Authorizer<'a, SM, W> where
SM::Sign: Debug,
impl<'a, SM: Debug + SignatureMethod, W: Debug> Debug for Authorizer<'a, SM, W> where
SM::Sign: Debug,
sourceimpl<'a, SM: SignatureMethod, W: Write> Serializer for Authorizer<'a, SM, W>
impl<'a, SM: SignatureMethod, W: Write> Serializer for Authorizer<'a, SM, W>
type Output = W
type Output = W
The type of the value produced by this serializer.
sourcefn serialize_parameter<V: Display>(&mut self, key: &str, value: V)
fn serialize_parameter<V: Display>(&mut self, key: &str, value: V)
Serializes a key-value pair. Read more
sourcefn serialize_parameter_encoded<V: Display>(&mut self, key: &str, value: V)
fn serialize_parameter_encoded<V: Display>(&mut self, key: &str, value: V)
Serializes a key-value pair. Read more
sourcefn serialize_oauth_callback(&mut self)
fn serialize_oauth_callback(&mut self)
Appends oauth_callback
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_consumer_key(&mut self)
fn serialize_oauth_consumer_key(&mut self)
Appends oauth_consumer_key
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_nonce(&mut self)
fn serialize_oauth_nonce(&mut self)
Appends oauth_nonce
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_signature_method(&mut self)
fn serialize_oauth_signature_method(&mut self)
Appends oauth_signature_method
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_timestamp(&mut self)
fn serialize_oauth_timestamp(&mut self)
Appends oauth_timestamp
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_token(&mut self)
fn serialize_oauth_token(&mut self)
Appends oauth_token
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_verifier(&mut self)
fn serialize_oauth_verifier(&mut self)
Appends oauth_verifier
parameter to the Authorization
header. Read more
sourcefn serialize_oauth_version(&mut self)
fn serialize_oauth_version(&mut self)
Appends oauth_version
parameter to the Authorization
header. Read more
Auto Trait Implementations
impl<'a, SM, W> RefUnwindSafe for Authorizer<'a, SM, W> where
W: RefUnwindSafe,
<SM as SignatureMethod>::Sign: RefUnwindSafe,
impl<'a, SM, W> Send for Authorizer<'a, SM, W> where
W: Send,
<SM as SignatureMethod>::Sign: Send,
impl<'a, SM, W> Sync for Authorizer<'a, SM, W> where
W: Sync,
<SM as SignatureMethod>::Sign: Sync,
impl<'a, SM, W> Unpin for Authorizer<'a, SM, W> where
W: Unpin,
<SM as SignatureMethod>::Sign: Unpin,
impl<'a, SM, W> UnwindSafe for Authorizer<'a, SM, W> where
W: UnwindSafe,
<SM as SignatureMethod>::Sign: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<S> SerializerExt for S where
S: Serializer,
impl<S> SerializerExt for S where
S: Serializer,
sourcefn serialize_oauth_parameters(&mut self)
fn serialize_oauth_parameters(&mut self)
Appends all oauth_*
parameter to the Authorization
header.