[][src]Struct oxide_auth::endpoint::Template

pub struct Template<'a> { /* fields omitted */ }

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.

Methods

impl<'a> Template<'a>[src]

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

impl<'a> Debug for Template<'a>[src]

Auto Trait Implementations

impl<'a> Unpin for Template<'a>

impl<'a> Send for Template<'a>

impl<'a> Sync for Template<'a>

impl<'a> RefUnwindSafe for Template<'a>

impl<'a> !UnwindSafe for Template<'a>

Blanket Implementations

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

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

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.

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

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

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

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> DebugAny for T where
    T: Any + Debug

impl<T> UnsafeAny for T where
    T: Any

impl<T> IntoCollection<T> for T

impl<T, I> AsResult<T, I> for T where
    I: Input,