ws-auth 0.0.3

A library to help build authentication services and client libraries for web services.
Documentation
use serde_json::Value;

// https://www.rcfed.com/SAMLWSFed/CommonClaimtypelist
// https://schemas.xmlsoap.org/ws/2005/05/identity/claims.xsd
pub mod claim_types {
    pub const AUTHENTICATION_METHOD: &str =
        "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod";
    pub const ROLE: &str = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role";
    pub const GROUP: &str = "http://schemas.xmlsoap.org/claims/group";
    pub const PRIMARY_SID: &str =
        "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid";
    pub const UPN: &str = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn";
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Claim {
    pub claim_type: String,
    pub value: Value,
}

impl Claim {
    pub fn new(claim_type: &str, value: Value) -> Claim {
        let claim_type_str = String::from(claim_type);

        Claim {
            claim_type: claim_type_str,
            value: value,
        }
    }
}