ws-auth 0.0.3

A library to help build authentication services and client libraries for web services.
Documentation
use crate::identity::ClaimsIdentity;

pub struct AuthenticationContext {
    identity: Option<ClaimsIdentity>,
}

impl AuthenticationContext {
    pub fn new() -> AuthenticationContext {
        AuthenticationContext {
            identity: Option::None,
        }
    }

    pub fn login(&mut self, identity: ClaimsIdentity) {
        self.identity = Some(identity);
    }

    pub fn logout(&mut self) {
        self.identity = Option::None
    }

    pub fn get_identity(&self) -> Option<ClaimsIdentity> {
        return self.identity.to_owned();
    }
}