Class IDFFMetaUtils


  • public class IDFFMetaUtils
    extends Object
    This class contains utility methods to process the IDFF Meta data.
    • Field Detail

      • debug

        public static Debug debug
        IDFF Meta Debug
      • IDFF_BUNDLE_NAME

        protected static String IDFF_BUNDLE_NAME
        Bundle Name
    • Constructor Detail

      • IDFFMetaUtils

        protected IDFFMetaUtils()
        Default Constructor
    • Method Detail

      • convertJAXBToString

        public static String convertJAXBToString​(Object jaxbObj)
                                          throws JAXBException
        Converts a JAXB object to a String object.
        Parameters:
        jaxbObj - a JAXB object
        Returns:
        a String representing the JAXB object.
        Throws:
        JAXBException - if an error occurs while converting JAXB object
      • convertJAXBToAttrMap

        protected static Map convertJAXBToAttrMap​(String attrName,
                                                  Object jaxbObj)
                                           throws JAXBException
        Converts a JAXB object to a String object and creates a Map. The key is 'attrName' and the value is a Set which contains the String object.
        Parameters:
        attrName - attribute name
        jaxbObj - a JAXB object
        Returns:
        a Map. The key is 'attrName' and the value is a Set contains the String object converted from the JAXB object.
        Throws:
        JAXBException - if an error occurs while converting JAXB object
      • convertNodeToJAXB

        public static Object convertNodeToJAXB​(Node node)
                                        throws JAXBException
        Converts a Node object to a JAXB object.
        Parameters:
        node - a Node object
        Returns:
        a JAXB object converted from the Node object
        Throws:
        JAXBException - if an error occurs while converting Node object
      • convertStringToJAXB

        public static Object convertStringToJAXB​(String str)
                                          throws JAXBException
        Converts a String object to a JAXB object.
        Parameters:
        str - a String object
        Returns:
        a JAXB object converted from the String object.
        Throws:
        JAXBException - if an error occurs while converting String object
      • getSPDescriptor

        public static com.sun.identity.liberty.ws.meta.jaxb.SPDescriptorType getSPDescriptor​(com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement entityDescriptor)
        Returns the SPDescriptor in the Entity Descriptor. If there is more then one SPDescriptor then the first one in the list is returned.
        Parameters:
        entityDescriptor - the EntityDescriptor element.
        Returns:
        the SPDescriptorType object.
      • getIDPDescriptor

        public static com.sun.identity.liberty.ws.meta.jaxb.IDPDescriptorType getIDPDescriptor​(com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement entityDescriptor)
        Returns the IDPDescriptor in the Entity Descriptor. If there multiple descriptors then the first retreived descriptor is returned.
        Parameters:
        entityDescriptor - the EntityDescriptor element.
        Returns:
        the IDPDescriptorType object.
      • getSPDescriptorConfig

        public static com.sun.identity.federation.jaxb.entityconfig.SPDescriptorConfigElement getSPDescriptorConfig​(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement entityConfig)
        Returns the Service Provider Entity Configuration. If there are multiple Configurations then the first configuration retreived is returned.
        Parameters:
        entityConfig - the EntityConfigElement object.
        Returns:
        the SPDescriptorEntityConfigElement object.
      • getIDPDescriptorConfig

        public static com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement getIDPDescriptorConfig​(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement entityConfig)
        Returns the Identity Provider Entity Configuration. If there are multiple Configuraitons then the first configuration retreived is returned.
        Parameters:
        entityConfig - the EntityConfigElement object.
        Returns:
        the IDPDescriptorEntityConfigElement object.
      • getAttributes

        public static Map getAttributes​(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType config)
        Gets attribute value pairs from BaseConfigType and put in a Map. The key is attribute name and the value is a List of attribute values.
        Parameters:
        config - the BaseConfigType object
        Returns:
        an attrbute value Map
      • getFirstAttributeValue

        public static String getFirstAttributeValue​(Map attrMap,
                                                    String key)
        Gets the first value of list by given key searching in the given map.
        Parameters:
        attrMap - Map of which list is to be retrieved.
        key - Key of the entry to be retrieved.
        Returns:
        the first value of a matching list by the given key. Returns null if attrMap is null or key is null.
      • isAutoFedEnabled

        public static boolean isAutoFedEnabled​(Map attributes)
      • getBooleanAttributeValueFromConfig

        public static boolean getBooleanAttributeValueFromConfig​(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType config,
                                                                 String attrName)
      • getFirstAttributeValueFromConfig

        public static String getFirstAttributeValueFromConfig​(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType config,
                                                              String attrName)
      • getAttributeValueFromConfig

        public static List getAttributeValueFromConfig​(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType config,
                                                       String attrName)
      • getRealmByMetaAlias

        public static String getRealmByMetaAlias​(String metaAlias)
        Returns the realm by parsing the metaAlias. MetaAlias format is
         <realm>/<any string without '/'> for non-root realm or
         /<any string without '/'> for root realm.
         
        Parameters:
        metaAlias - The metaAlias.
        Returns:
        the realm associated with the metaAlias.
      • getMetaAliasByUri

        public static String getMetaAliasByUri​(String uri)
        Returns metaAlias embedded in uri.
        Parameters:
        uri - The uri string.
        Returns:
        the metaAlias embedded in uri or null if not found.
      • getMetaAlias

        public static String getMetaAlias​(String realm,
                                          String providerID,
                                          String providerRole,
                                          Object session)
        Obtains provider's meta alias.
        Parameters:
        realm - the realm in which the provider resides
        providerID - provider's entity ID
        providerRole - provider's role
        session - user session object
        Returns:
        service provider's meta alias; or null if an error occurs.
      • getExtendedConfig

        public static com.sun.identity.federation.jaxb.entityconfig.BaseConfigType getExtendedConfig​(String realm,
                                                                                                     String providerId,
                                                                                                     String providerRole,
                                                                                                     IDFFMetaManager metaManager)
        Obtains provider's extended meta.
        Parameters:
        realm - the realm in which the provider resides
        providerId - provider's entity ID
        providerRole - provider's role
        metaManager - IDFFMetaManager instance.
        Returns:
        provider's extended meta; or null if an error occurs.