[−][src]Struct oxide_auth::endpoint::Template
Modifiable reason for creating a response to the client.
Not all responses indicate failure. A redirect will also occur in the a regular of providing an access token to the third party client. When an error is present (see several methods) it is mostly possible to customize it. This hook provides advanced endpoints with the opportunity to set additional parameters and informational messages before they are encoded.
See the provided methods for more information and examples.
Implementations
impl<'a> Template<'a>
[src]
pub fn new_ok() -> Self
[src]
Create an OK template
pub fn new_bad(access_token_error: Option<&'a mut AccessTokenError>) -> Self
[src]
Create a bad request template
pub fn new_unauthorized(
error: Option<ResourceError>,
access_token_error: Option<&'a mut AccessTokenError>
) -> Self
[src]
error: Option<ResourceError>,
access_token_error: Option<&'a mut AccessTokenError>
) -> Self
Create an unauthorized template
pub fn new_redirect(
authorization_error: Option<&'a mut AuthorizationError>
) -> Self
[src]
authorization_error: Option<&'a mut AuthorizationError>
) -> Self
Create a redirect template
pub fn status(&self) -> ResponseStatus
[src]
The corresponding status code.
pub fn authorization_error(&mut self) -> Option<&mut AuthorizationError>
[src]
Supplementary information about an error in the authorization code flow.
The referenced object can be inspected and manipulated to provided additional information that is specific to this server or endpoint. Such information could be an error page with explanatory information or a customized message.
fn explain(mut template: Template) { if let Some(error) = template.authorization_error() { eprintln!("[authorization] An error occurred: {:?}", error.kind()); error.explain("This server is still in its infancy. Sorry."); error.explain_uri("/authorization_error.html".parse().unwrap()); } }
pub fn access_token_error(&mut self) -> Option<&mut AccessTokenError>
[src]
Supplementary information about an error in the access token flow.
The referenced object can be inspected and manipulated to provided additional information that is specific to this server or endpoint. Such information could be an error page with explanatory information or a customized message.
fn explain(mut template: Template) { if let Some(error) = template.access_token_error() { eprintln!("[access_code] An error occurred: {:?}", error.kind()); error.explain("This server is still in its infancy. Sorry."); error.explain_uri("/access_token_error.html".parse().unwrap()); } }
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Template<'a>
impl<'a> Send for Template<'a>
impl<'a> Sync for Template<'a>
impl<'a> Unpin for Template<'a>
impl<'a> !UnwindSafe for Template<'a>
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,
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> Same<T> for T
type Output = T
Should always be Self
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,