ws_auth/claims/
mod.rs

1use serde_json::Value;
2
3// https://www.rcfed.com/SAMLWSFed/CommonClaimtypelist
4// https://schemas.xmlsoap.org/ws/2005/05/identity/claims.xsd
5pub mod claim_types {
6    pub const AUTHENTICATION_METHOD: &str =
7        "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod";
8    pub const ROLE: &str = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role";
9    pub const GROUP: &str = "http://schemas.xmlsoap.org/claims/group";
10    pub const PRIMARY_SID: &str =
11        "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid";
12    pub const UPN: &str = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn";
13}
14
15#[derive(Debug, Serialize, Deserialize, Clone)]
16pub struct Claim {
17    pub claim_type: String,
18    pub value: Value,
19}
20
21impl Claim {
22    pub fn new(claim_type: &str, value: Value) -> Claim {
23        let claim_type_str = String::from(claim_type);
24
25        Claim {
26            claim_type: claim_type_str,
27            value: value,
28        }
29    }
30}