Class MetadataUtils
- java.lang.Object
-
- se.litsec.opensaml.saml2.metadata.MetadataUtils
-
public class MetadataUtils extends Object
Utility methods for accessing metadata elements.- Author:
- Martin Lindström (martin.lindstrom@litsec.se)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<DigestMethod>getDigestMethods(EntityDescriptor ed)Returns a (possibly) empty list ofalg:DigestMethodelements.static Optional<EntityAttributes>getEntityAttributes(EntityDescriptor ed)Returns theEntityAttributeselement that is placed as an extension to the supplied entity descriptor.static List<X509Credential>getMetadataCertificates(EntityDescriptor ed, UsageType usageType)Utility that extracs certificates found under the KeyDescriptor elements of a metadata record.static <T> Optional<T>getMetadataExtension(Extensions extensions, Class<T> clazz)Finds the first extension matching the supplied type.static <T> List<T>getMetadataExtensions(Extensions extensions, Class<T> clazz)Finds all extensions matching the supplied type.static List<SigningMethod>getSigningMethods(EntityDescriptor ed)Returns a (possibly) empty list ofalg:SigningMethodelements.static SSODescriptorgetSSODescriptor(EntityDescriptor ed)Returns the SSODescriptor for the supplied SP or IdP entity descriptor.static Optional<String>getUiDescription(EntityDescriptor ed, String language)Utility method that returns themdui:Descriptionelement for the given language tag from the SSO descriptor extension of the supplied entity descriptor.static List<Description>getUiDescriptions(EntityDescriptor ed)Utility method that returns a list of themdui:Descriptionelement found in the SSO descriptor extension of the supplied entity descriptor.static Optional<String>getUiDisplayName(EntityDescriptor ed, String language)Utility method that returns themdui:DisplayNameelement for the given language tag from the SSO descriptor extension of the supplied entity descriptor.static List<DisplayName>getUiDisplayNames(EntityDescriptor ed)Utility method that returns a list of themdui:DisplayNameelement found in the SSO descriptor extension of the supplied entity descriptor.
-
-
-
Method Detail
-
getMetadataExtension
public static <T> Optional<T> getMetadataExtension(Extensions extensions, Class<T> clazz)
Finds the first extension matching the supplied type.- Type Parameters:
T- the type of the extension- Parameters:
extensions- theExtensionsto searchclazz- the extension type- Returns:
- the matching extension
-
getMetadataExtensions
public static <T> List<T> getMetadataExtensions(Extensions extensions, Class<T> clazz)
Finds all extensions matching the supplied type.- Type Parameters:
T- the type of the extension- Parameters:
extensions- theExtensionsto searchclazz- the extension type- Returns:
- a (possibly empty) list of extensions elements of the given type
-
getEntityAttributes
public static Optional<EntityAttributes> getEntityAttributes(EntityDescriptor ed)
Returns theEntityAttributeselement that is placed as an extension to the supplied entity descriptor.- Parameters:
ed- the entity descriptor- Returns:
- the EntityAttributes element
-
getUiDisplayNames
public static List<DisplayName> getUiDisplayNames(EntityDescriptor ed)
Utility method that returns a list of themdui:DisplayNameelement found in the SSO descriptor extension of the supplied entity descriptor.- Parameters:
ed- the entity descriptor- Returns:
- a (possibly empty) list of
DisplayNameelements
-
getUiDisplayName
public static Optional<String> getUiDisplayName(EntityDescriptor ed, String language)
Utility method that returns themdui:DisplayNameelement for the given language tag from the SSO descriptor extension of the supplied entity descriptor.- Parameters:
ed- the entity descriptorlanguage- the language tag- Returns:
- the display name for the given language
-
getUiDescriptions
public static List<Description> getUiDescriptions(EntityDescriptor ed)
Utility method that returns a list of themdui:Descriptionelement found in the SSO descriptor extension of the supplied entity descriptor.- Parameters:
ed- the entity descriptor- Returns:
- a (possibly empty) list of
Descriptionelements
-
getUiDescription
public static Optional<String> getUiDescription(EntityDescriptor ed, String language)
Utility method that returns themdui:Descriptionelement for the given language tag from the SSO descriptor extension of the supplied entity descriptor.- Parameters:
ed- the entity descriptorlanguage- the language tag- Returns:
- the description for the given language
-
getMetadataCertificates
public static List<X509Credential> getMetadataCertificates(EntityDescriptor ed, UsageType usageType)
Utility that extracs certificates found under the KeyDescriptor elements of a metadata record.If
UsageType.SIGNINGis supplied, the method will return all certificates with usage type signing, but also those that does not have a usage. And the same goes for encryption.- Parameters:
ed- the metadata recordusageType- the requested usage type- Returns:
- a list of credentials
-
getDigestMethods
public static List<DigestMethod> getDigestMethods(EntityDescriptor ed)
Returns a (possibly) empty list ofalg:DigestMethodelements. "SAML v2.0 Metadata Profile for Algorithm Support Version 1.0" states that elements found in the extension under the role descriptor has precedence over those found under the entity descriptor extensions, and the sets should not be combined if both are present.- Parameters:
ed- the entity descriptor- Returns:
- a list of digest methods (may be empty)
-
getSigningMethods
public static List<SigningMethod> getSigningMethods(EntityDescriptor ed)
Returns a (possibly) empty list ofalg:SigningMethodelements. "SAML v2.0 Metadata Profile for Algorithm Support Version 1.0" states that elements found in the extension under the role descriptor has precedence over those found under the entity descriptor extensions, and the sets should not be combined if both are present.- Parameters:
ed- the entity descriptor- Returns:
- a list of signing methods (may be empty)
-
getSSODescriptor
public static SSODescriptor getSSODescriptor(EntityDescriptor ed)
Returns the SSODescriptor for the supplied SP or IdP entity descriptor.- Parameters:
ed- the entity descriptor- Returns:
- the SSODescriptor
-
-