pub struct EntitiesDescriptor {
pub name: Option<String>,
pub valid_until: Option<SystemTime>,
pub entities: Vec<MetadataEntry>,
}Expand description
Parsed <md:EntitiesDescriptor> (or a single <md:EntityDescriptor>
promoted to an aggregate with one entry, for caller convenience).
Fields§
§name: Option<String>§valid_until: Option<SystemTime>§entities: Vec<MetadataEntry>Implementations§
Source§impl EntitiesDescriptor
impl EntitiesDescriptor
Sourcepub fn from_metadata_xml(xml: &[u8]) -> Result<Self, Error>
pub fn from_metadata_xml(xml: &[u8]) -> Result<Self, Error>
Parse a federation aggregate or a single-entity metadata document.
Uses an aggregate-sized node ceiling (XmlLimits::aggregate) so real
InCommon / eduGAIN aggregates — which exceed the default ~100k-node
limit — parse successfully. To parse under tighter (or looser) limits,
use from_metadata_xml_with_limits.
Sourcepub fn from_metadata_xml_with_limits(
xml: &[u8],
limits: XmlLimits,
) -> Result<Self, Error>
pub fn from_metadata_xml_with_limits( xml: &[u8], limits: XmlLimits, ) -> Result<Self, Error>
Parse a federation aggregate or single-entity metadata document under caller-supplied resource limits.
from_metadata_xml calls this with
XmlLimits::aggregate; pass a tighter XmlLimits when the input is
known to be small and you want a smaller worst-case allocation bound.
Sourcepub fn by_entity_id(&self, entity_id: &str) -> Option<&MetadataEntry>
pub fn by_entity_id(&self, entity_id: &str) -> Option<&MetadataEntry>
Find an entry by its entityID, regardless of role. Returns the first
match in document order.
This is a linear scan over entities. For repeated
lookups against a large aggregate (InCommon publishes thousands of
entities), build an index once with index_by_entity_id and query
that instead.
Sourcepub fn index_by_entity_id(&self) -> HashMap<&str, &MetadataEntry>
pub fn index_by_entity_id(&self) -> HashMap<&str, &MetadataEntry>
Build a HashMap from entityID to entry for O(1) repeated lookups.
Federation aggregates with thousands of entities make the linear
by_entity_id / find_idp / find_sp scans expensive when a
caller resolves many entityIDs; constructing this index once amortizes
the cost. Other entries (no entityID) are skipped. When a
duplicate entityID appears the first entry in document order wins,
matching the linear accessors.
Sourcepub fn find_idp(&self, entity_id: &str) -> Option<&IdpDescriptor>
pub fn find_idp(&self, entity_id: &str) -> Option<&IdpDescriptor>
Find an IdP entity by entity ID.
Sourcepub fn find_sp(&self, entity_id: &str) -> Option<&SpDescriptor>
pub fn find_sp(&self, entity_id: &str) -> Option<&SpDescriptor>
Find an SP entity by entity ID.
Sourcepub fn iter_idps(&self) -> impl Iterator<Item = &IdpDescriptor>
pub fn iter_idps(&self) -> impl Iterator<Item = &IdpDescriptor>
Iterate over all IdP descriptors (including the IdP half of Dual entries).
Sourcepub fn iter_sps(&self) -> impl Iterator<Item = &SpDescriptor>
pub fn iter_sps(&self) -> impl Iterator<Item = &SpDescriptor>
Iterate over all SP descriptors (including the SP half of Dual entries).