public final class SAML2MetaUtils extends Object
SAML2MetaUtils
provides metadata related util methods.Modifier and Type | Field and Description |
---|---|
static Debug |
debug |
protected static String |
RESOURCE_BUNDLE_NAME |
protected static ResourceBundle |
resourceBundle |
Modifier and Type | Method and Description |
---|---|
static Object |
convertInputStreamToJAXB(InputStream is)
Reads from the
InputStream and converts to a JAXB object. |
protected static Map |
convertJAXBToAttrMap(String attrName,
Object jaxbObj)
Converts a JAXB object to a
String object and creates a
Map . |
static void |
convertJAXBToOutputStream(Object jaxbObj,
OutputStream os)
Converts a JAXB object and writes to an
OutputStream object. |
static String |
convertJAXBToString(Object jaxbObj)
Converts a JAXB object to a
String object. |
static Object |
convertNodeToJAXB(Node node)
Converts a
Node object to a JAXB object. |
static Object |
convertStringToJAXB(String str)
Converts a
String object to a JAXB object. |
static String |
exportStandardMeta(String realm,
String entityID,
boolean sign) |
static void |
fillEntriesInSet(Map attrMap,
String key,
String value)
Adds a set of a given value to a map.
|
static AttributeAuthorityDescriptorElement |
getAttributeAuthorityDescriptor(EntityDescriptorElement eDescriptor)
Returns attribute authority descriptor in an entity descriptor.
|
static AttributeQueryDescriptorElement |
getAttributeQueryDescriptor(EntityDescriptorElement eDescriptor)
Returns attribute query descriptor in an entity descriptor.
|
static Map<String,List<String>> |
getAttributes(BaseConfigType config)
Gets attribute value pairs from
BaseConfigType and
put in a Map . |
static AuthnAuthorityDescriptorElement |
getAuthnAuthorityDescriptor(EntityDescriptorElement eDescriptor)
Returns authentication authority descriptor in an entity descriptor.
|
static EntityDescriptorElement |
getEntityDescriptorElement(String metadata) |
static String |
getFirstEntry(Map attrMap,
String key)
Get the first value of set by given key searching in the given map.
|
static IDPSSOConfigElement |
getIDPSSOConfig(EntityConfigElement eConfig)
Returns first identity provider's SSO configuration in an entity
|
static IDPSSODescriptorElement |
getIDPSSODescriptor(EntityDescriptorElement eDescriptor)
Returns first identity provider's SSO descriptor in an entity
descriptor.
|
static String |
getMetaAliasByUri(String uri)
Returns metaAlias embedded in uri.
|
static JAXBContext |
getMetaJAXBContext()
Returns
JAXB context for the metadata service. |
static XACMLPDPDescriptorElement |
getPolicyDecisionPointDescriptor(EntityDescriptorElement eDescriptor)
Returns first policy decision point descriptor in an entity descriptor.
|
static XACMLAuthzDecisionQueryDescriptorElement |
getPolicyEnforcementPointDescriptor(EntityDescriptorElement eDescriptor)
Returns first policy enforcement point descriptor in an entity
descriptor.
|
static String |
getRealmByMetaAlias(String metaAlias)
Returns the realm by parsing the metaAlias.
|
static SPSSOConfigElement |
getSPSSOConfig(EntityConfigElement eConfig)
Returns first service provider's SSO configuration in an entity.
|
static SPSSODescriptorElement |
getSPSSODescriptor(EntityDescriptorElement eDescriptor)
Returns first service provider's SSO descriptor in an entity
descriptor.
|
static List<String> |
importSAML2Document(SAML2MetaManager metaManager,
String realm,
Document doc)
For the given XML metadata document representing either a SAML2 EntityDescriptorElement or EntitiesDescriptorElement,
return a list of entityId's for all the Entities created.
|
protected static final String RESOURCE_BUNDLE_NAME
protected static ResourceBundle resourceBundle
public static Debug debug
public static JAXBContext getMetaJAXBContext()
JAXB
context for the metadata service.JAXB
context object.public static Object convertStringToJAXB(String str) throws JAXBException
String
object to a JAXB object.str
- a String
objectString
object.JAXBException
- if an error occurs while converting
String
objectpublic static Object convertInputStreamToJAXB(InputStream is) throws JAXBException
InputStream
and converts to a JAXB object.is
- a InputStream
objectInputStream
object.JAXBException
- if an error occurs while converting
InputStream
objectpublic static Object convertNodeToJAXB(Node node) throws JAXBException
Node
object to a JAXB object.node
- a Node
objectNode
object.JAXBException
- if an error occurs while converting
Node
objectpublic static String convertJAXBToString(Object jaxbObj) throws JAXBException
String
object.jaxbObj
- a JAXB objectString
representing the JAXB object.JAXBException
- if an error occurs while converting JAXB objectpublic static void convertJAXBToOutputStream(Object jaxbObj, OutputStream os) throws JAXBException
OutputStream
object.jaxbObj
- a JAXB objectos
- an OutputStream
objectJAXBException
- if an error occurs while converting JAXB objectprotected static Map convertJAXBToAttrMap(String attrName, Object jaxbObj) throws JAXBException
String
object and creates a
Map
. The key is 'attrName' and the value is a
Set
contains the String
object.attrName
- attribute namejaxbObj
- a JAXB objectMap
. The key is 'attrName' and the value is a
Set
contains the String
object
converted from the JAXB object.JAXBException
- if an error occurs while converting JAXB objectpublic static Map<String,List<String>> getAttributes(BaseConfigType config)
BaseConfigType
and
put in a Map
. The key is attribute name and the value is
a List
of attribute values;config
- the BaseConfigType
objectMap
public static String getRealmByMetaAlias(String metaAlias)
<realm>/<any string without '/'> for non-root realm or /<any string without '/'> for root realm.
metaAlias
- The metaAlias.public static String getMetaAliasByUri(String uri)
uri
- The uri string.public static XACMLPDPDescriptorElement getPolicyDecisionPointDescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.public static XACMLAuthzDecisionQueryDescriptorElement getPolicyEnforcementPointDescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.public static SPSSODescriptorElement getSPSSODescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.SPSSODescriptorElement
for the entity or null if
not found.public static IDPSSODescriptorElement getIDPSSODescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.IDPSSODescriptorElement
for the entity or null if
not found.public static AttributeAuthorityDescriptorElement getAttributeAuthorityDescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.AttributeAuthorityDescriptorElement
object for
the entity or null if not found.public static AttributeQueryDescriptorElement getAttributeQueryDescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.AttributeQueryDescriptorElement
object for
the entity or null if not found.public static AuthnAuthorityDescriptorElement getAuthnAuthorityDescriptor(EntityDescriptorElement eDescriptor)
eDescriptor
- The entity descriptor.AuthnAuthorityDescriptorElement
object for
the entity or null if not found.public static String getFirstEntry(Map attrMap, String key)
attrMap
is null or key
is null.attrMap
- Map of which set is to be added.key
- Key of the entry to be added.public static void fillEntriesInSet(Map attrMap, String key, String value)
attrMap
is null or value
is null or
key
is null.attrMap
- Map of which set is to be added.key
- Key of the entry to be added.value
- Value to be added to the Set.public static SPSSOConfigElement getSPSSOConfig(EntityConfigElement eConfig) throws SAML2MetaException
eConfig
- EntityConfigElement
of the entity to
be retrieved.SPSSOConfigElement
for the entity or null if not
found.SAML2MetaException
- if unable to retrieve the first service
provider's SSO configuration.public static IDPSSOConfigElement getIDPSSOConfig(EntityConfigElement eConfig) throws SAML2MetaException
eConfig
- EntityConfigElement
of the entity to
be retrieved.IDPSSOConfigElement
for the entity or null if not
found.SAML2MetaException
- if unable to retrieve the first identity
provider's SSO configuration.public static String exportStandardMeta(String realm, String entityID, boolean sign) throws SAML2MetaException
SAML2MetaException
public static EntityDescriptorElement getEntityDescriptorElement(String metadata) throws SAML2MetaException, JAXBException
metadata
- A string representing an EntityDescriptorElement XML documentSAML2MetaException
- If there was a problem with the parsed metadataJAXBException
- If there was a problem parsing the metadatapublic static List<String> importSAML2Document(SAML2MetaManager metaManager, String realm, Document doc) throws SAML2MetaException, JAXBException
metaManager
- An instance of the SAML2MetaManager, used to do the actual create.realm
- The realm to create the Entities indoc
- The XML document that represents either an EntityDescriptorElement or EntitiesDescriptorElementSAML2MetaException
- for any issues as a result of trying to create the Entities.JAXBException
- for any issues converting the document into a JAXB document.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.