Class Util

java.lang.Object
com.atlassian.crowd.plugin.saml.Util

public class Util extends Object
This utility class is used across the various servlets that make up the SAML-based Single Sign-On Reference Tool. It includes various helper methods that are used for the SAML transactions.
  • Method Details

    • toW3cDom

      public static Element toW3cDom(org.dom4j.Element element) throws ParserConfigurationException, IOException, SAXException
      Throws:
      ParserConfigurationException
      IOException
      SAXException
    • toDom4j

      public static org.dom4j.Element toDom4j(Document document)
    • createDom4jDoc

      public static org.dom4j.Document createDom4jDoc(String xmlString) throws SAMLException
      Throws:
      SAMLException
    • createID

      public static String createID()
      Create a randomly generated string conforming to the xsd:ID datatype. containing 160 bits of non-cryptographically strong pseudo-randomness, as suggested by SAML 2.0 core 1.2.3. This will also apply to version 1.1
      Returns:
      the randomly generated string
    • getDateAndTime

      public static String getDateAndTime(Date date)
      Gets the current date and time in the format specified by xsd:dateTime in UTC form, as described in SAML 2.0 core 1.2.2 This will also apply to Version 1.1
      Parameters:
      date - date of SAML timestamp.
      Returns:
      the date and time as a String
    • htmlEncode

      public static String htmlEncode(String s)
      Returns HTML encoded version of the specified String s.
      Parameters:
      s - String to be HTML encoded
      Returns:
      HTML encoded String