Expand description
§OpenID Federation Metadata Policy
This crate implements metadata policy operations for OpenID Federation as specified in OpenID Federation 1.0.
It provides functionality to:
- Merge metadata policies from Trust Anchors and Intermediate Authorities
- Apply metadata policies to entity metadata
- Resolve metadata according to policy constraints
§Example
use serde_json::json;
let metadata = json!({
"openid_relying_party": {
"application_type": "web",
"grant_types": ["authorization_code", "implicit"]
}
});
let full_policy = json!({
"metadata_policy": {},
"metadata": {
"openid_relying_party": {
"application_type": "native"
}
}
});
let result = oidfed_metadata_policy::apply_policy_document_on_metadata(
full_policy.as_object().unwrap(),
metadata.as_object().unwrap()
).unwrap();
assert_eq!(result["openid_relying_party"]["application_type"], "native");
assert_eq!(result["openid_relying_party"]["grant_types"], json!(["authorization_code", "implicit"]));Functions§
- apply_
policy_ document_ on_ metadata - Applies a full policy document on the raw metadata of a given entity.
- apply_
policy_ on_ metadata - Applies a metadata policy to metadata for a single entity type.
- check_
equal - Checks if two JSON values are equal using unordered set comparison.
- get_
hashset_ from_ only_ names - Extracts only the names (keys) from a JSON value into a
HashSet. - get_
hashset_ from_ values - Converts a JSON value into a
HashSetof values. - get_
ordered_ array - Returns an ordered array by merging items from Trust Anchor and Intermediate Authority.
- intersection_
of - Computes the intersection of two JSON values as sets.
- is_
subset_ of - Checks if the first value is a subset of the second value.
- is_
superset_ of - Checks if the first value is a superset of the second value.
- merge_
one_ type_ policy - Merges metadata policies for a single entity type from Trust Anchor and Intermediate Authority.
- merge_
policies - Merges a Trust Anchor’s (TA) policy on top of an Intermediate Authority’s (IA) policy according to the OpenID Federation policy merging rules.
- resolve_
metadata_ policy - Resolves metadata according to a given policy.