pub mod emit_aggregate;
pub mod emit_idp;
pub mod emit_sp;
pub mod parse;
#[derive(Debug, Clone, Default)]
pub struct MetadataExtras {
pub organization: Option<MetadataOrganization>,
pub contacts: Vec<MetadataContact>,
#[cfg(feature = "idp-disco")]
pub discovery_response_endpoints: Vec<crate::disco::DiscoveryResponseEndpoint>,
}
#[derive(Debug, Clone)]
pub struct MetadataOrganization {
pub name: String,
pub display_name: String,
pub url: String,
pub language: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MetadataContactType {
Technical,
Support,
Administrative,
Billing,
Other,
}
impl MetadataContactType {
pub fn as_str(self) -> &'static str {
match self {
Self::Technical => "technical",
Self::Support => "support",
Self::Administrative => "administrative",
Self::Billing => "billing",
Self::Other => "other",
}
}
}
#[derive(Debug, Clone)]
pub struct MetadataContact {
pub contact_type: MetadataContactType,
pub given_name: Option<String>,
pub surname: Option<String>,
pub email_addresses: Vec<String>,
pub telephone_numbers: Vec<String>,
pub company: Option<String>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn contact_type_as_str_matches_schema_tokens() {
assert_eq!(MetadataContactType::Technical.as_str(), "technical");
assert_eq!(MetadataContactType::Support.as_str(), "support");
assert_eq!(
MetadataContactType::Administrative.as_str(),
"administrative"
);
assert_eq!(MetadataContactType::Billing.as_str(), "billing");
assert_eq!(MetadataContactType::Other.as_str(), "other");
}
#[test]
fn extras_default_is_empty() {
let e = MetadataExtras::default();
assert!(e.organization.is_none());
assert!(e.contacts.is_empty());
}
}