Class IdPMetadataParser


  • public class IdPMetadataParser
    extends java.lang.Object
    IdPMetadataParser class of OneLogin's Java Toolkit. A class that implements the settings parser from IdP Metadata This class does not validate in any way the URL that is introduced, make sure to validate it properly before use it in a get_metadata method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.slf4j.Logger LOGGER
      Private property to construct a logger for this class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Saml2Settings injectIntoSettings​(Saml2Settings settings, java.util.Map<java.lang.String,​java.lang.Object> metadataInfo)
      Inject metadata info into Saml2Settings
      static java.util.Map<java.lang.String,​java.lang.Object> parseFileXML​(java.lang.String xmlFileName)
      Get IdP Metadata Info from XML file
      static java.util.Map<java.lang.String,​java.lang.Object> parseFileXML​(java.lang.String xmlFileName, java.lang.String entityId)
      Get IdP Metadata Info from XML file
      static java.util.Map<java.lang.String,​java.lang.Object> parseFileXML​(java.lang.String xmlFileName, java.lang.String entityId, java.lang.String desiredNameIdFormat, java.lang.String desiredSSOBinding, java.lang.String desiredSLOBinding)
      Get IdP Metadata Info from XML file
      static java.util.Map<java.lang.String,​java.lang.Object> parseRemoteXML​(java.net.URL xmlURL)
      Get IdP Metadata Info from XML file
      static java.util.Map<java.lang.String,​java.lang.Object> parseRemoteXML​(java.net.URL xmlURL, java.lang.String entityId)
      Get IdP Metadata Info from XML file
      static java.util.Map<java.lang.String,​java.lang.Object> parseRemoteXML​(java.net.URL xmlURL, java.lang.String entityId, java.lang.String desiredNameIdFormat, java.lang.String desiredSSOBinding, java.lang.String desiredSLOBinding)
      Get IdP Metadata Info from XML file
      static java.util.Map<java.lang.String,​java.lang.Object> parseXML​(org.w3c.dom.Document xmlDocument)
      Get IdP Metadata Info from XML Document
      static java.util.Map<java.lang.String,​java.lang.Object> parseXML​(org.w3c.dom.Document xmlDocument, java.lang.String entityId)
      Get IdP Metadata Info from XML Document
      static java.util.Map<java.lang.String,​java.lang.Object> parseXML​(org.w3c.dom.Document xmlDocument, java.lang.String entityId, java.lang.String desiredNameIdFormat, java.lang.String desiredSSOBinding, java.lang.String desiredSLOBinding)
      Get IdP Metadata Info from XML Document
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
        Private property to construct a logger for this class.
    • Constructor Detail

      • IdPMetadataParser

        public IdPMetadataParser()
    • Method Detail

      • parseXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseXML​(org.w3c.dom.Document xmlDocument,
                                                                                      java.lang.String entityId,
                                                                                      java.lang.String desiredNameIdFormat,
                                                                                      java.lang.String desiredSSOBinding,
                                                                                      java.lang.String desiredSLOBinding)
                                                                               throws javax.xml.xpath.XPathException
        Get IdP Metadata Info from XML Document
        Parameters:
        xmlDocument - XML document hat contains IdP metadata
        entityId - Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
        desiredNameIdFormat - If available on IdP metadata, use that nameIdFormat
        desiredSSOBinding - Parse specific binding SSO endpoint.
        desiredSLOBinding - Parse specific binding SLO endpoint.
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        javax.xml.xpath.XPathExpressionException
        javax.xml.xpath.XPathException
      • parseXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseXML​(org.w3c.dom.Document xmlDocument,
                                                                                      java.lang.String entityId)
                                                                               throws javax.xml.xpath.XPathException
        Get IdP Metadata Info from XML Document
        Parameters:
        xmlDocument - XML document that contains IdP metadata
        entityId - Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        javax.xml.xpath.XPathException
      • parseXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseXML​(org.w3c.dom.Document xmlDocument)
                                                                               throws javax.xml.xpath.XPathException
        Get IdP Metadata Info from XML Document
        Parameters:
        xmlDocument - XML document that contains IdP metadata
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        javax.xml.xpath.XPathException
      • parseFileXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseFileXML​(java.lang.String xmlFileName,
                                                                                          java.lang.String entityId,
                                                                                          java.lang.String desiredNameIdFormat,
                                                                                          java.lang.String desiredSSOBinding,
                                                                                          java.lang.String desiredSLOBinding)
                                                                                   throws java.lang.Exception
        Get IdP Metadata Info from XML file
        Parameters:
        xmlFileName - Filename of the XML filename that contains IdP metadata
        entityId - Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
        desiredNameIdFormat - If available on IdP metadata, use that nameIdFormat
        desiredSSOBinding - Parse specific binding SSO endpoint.
        desiredSLOBinding - Parse specific binding SLO endpoint.
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        java.lang.Exception
      • parseFileXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseFileXML​(java.lang.String xmlFileName,
                                                                                          java.lang.String entityId)
                                                                                   throws java.lang.Exception
        Get IdP Metadata Info from XML file
        Parameters:
        xmlFileName - Filename of the XML filename that contains IdP metadata
        entityId - Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        java.lang.Exception
      • parseFileXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseFileXML​(java.lang.String xmlFileName)
                                                                                   throws java.lang.Exception
        Get IdP Metadata Info from XML file
        Parameters:
        xmlFileName - Filename of the XML filename that contains IdP metadata
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        java.lang.Exception
      • parseRemoteXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseRemoteXML​(java.net.URL xmlURL,
                                                                                            java.lang.String entityId,
                                                                                            java.lang.String desiredNameIdFormat,
                                                                                            java.lang.String desiredSSOBinding,
                                                                                            java.lang.String desiredSLOBinding)
                                                                                     throws java.lang.Exception
        Get IdP Metadata Info from XML file
        Parameters:
        xmlURL - URL to the XML document that contains IdP metadata
        entityId - Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
        desiredNameIdFormat - If available on IdP metadata, use that nameIdFormat
        desiredSSOBinding - Parse specific binding SSO endpoint.
        desiredSLOBinding - Parse specific binding SLO endpoint.
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        java.lang.Exception
      • parseRemoteXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseRemoteXML​(java.net.URL xmlURL,
                                                                                            java.lang.String entityId)
                                                                                     throws java.lang.Exception
        Get IdP Metadata Info from XML file
        Parameters:
        xmlURL - URL to the XML document that contains IdP metadata
        entityId - Entity Id of the desired IdP, if no entity Id is provided and the XML metadata contains more than one IDPSSODescriptor, the first is returned
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        java.lang.Exception
      • parseRemoteXML

        public static java.util.Map<java.lang.String,​java.lang.Object> parseRemoteXML​(java.net.URL xmlURL)
                                                                                     throws java.lang.Exception
        Get IdP Metadata Info from XML file
        Parameters:
        xmlURL - URL to the XML document that contains IdP metadata
        Returns:
        Mapped values with metadata info in Saml2Settings format
        Throws:
        java.lang.Exception
      • injectIntoSettings

        public static Saml2Settings injectIntoSettings​(Saml2Settings settings,
                                                       java.util.Map<java.lang.String,​java.lang.Object> metadataInfo)
        Inject metadata info into Saml2Settings
        Parameters:
        settings - the Saml2Settings object
        metadataInfo - mapped values with metadata info in Saml2Settings format
        Returns:
        the Saml2Settings object with metadata info settings loaded