[][src]Struct tophat::server::identity::Identity

pub struct Identity { /* fields omitted */ }

Identity "middlware", for handling authorized sessions.

Implementations

impl Identity[src]

pub fn build(server_key: &str) -> IdentityBuilder[src]

Create a new instance.

The server_key is used for signing and validating the jwt token.

pub fn authorized_user(&self, req: &Request) -> Option<String>[src]

Checked for an authorized user for the incoming request

pub fn set_auth_token<W>(&self, user: &str, resp_wtr: &mut ResponseWriter<W>) where
    W: AsyncRead + AsyncWrite + Clone + Send + Sync + Unpin + 'static, 
[src]

Set a token on the ResponseWriter, which gets set in a cookie, which authorizes the user.

pub fn forget<W>(&self, resp_wtr: &mut ResponseWriter<W>) where
    W: AsyncRead + AsyncWrite + Clone + Send + Sync + Unpin + 'static, 
[src]

Set an expired token on the ResponseWriter, which gets set in a cookie, which will effectively "log out" the user.

Trait Implementations

impl Clone for Identity[src]

Auto Trait Implementations

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> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.