com.atlassian.crowd.plugin.saml
Class Util

java.lang.Object
  extended by 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.


Constructor Summary
Util()
           
 
Method Summary
static String createID()
          Create a randomly generated string conforming to the xsd:ID datatype.
static org.jdom.Document createJdomDoc(String xmlString)
          Creates a JDOM Document from a string containing XML
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
static String htmlEncode(String s)
          Returns HTML encoded version of the specified String s.
static Document toDom(org.jdom.Document doc)
          Converts a JDOM Document to a W3 DOM document.
static Element toDom(org.jdom.Element element)
          Converts a JDOM Element to a W3 DOM Element
static org.jdom.Element toJdom(Element e)
          Converts a W3 DOM Element to a JDOM Element
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

toDom

public static Document toDom(org.jdom.Document doc)
                      throws SAMLException
Converts a JDOM Document to a W3 DOM document.

Parameters:
doc - JDOM Document
Returns:
W3 DOM Document if converted successfully, null otherwise
Throws:
SAMLException

toDom

public static Element toDom(org.jdom.Element element)
                     throws SAMLException
Converts a JDOM Element to a W3 DOM Element

Parameters:
element - JDOM Element
Returns:
W3 DOM Element if converted successfully, null otherwise
Throws:
SAMLException

toJdom

public static org.jdom.Element toJdom(Element e)
Converts a W3 DOM Element to a JDOM Element

Parameters:
e - W3 DOM Element
Returns:
JDOM Element

createJdomDoc

public static org.jdom.Document createJdomDoc(String xmlString)
                                       throws SAMLException
Creates a JDOM Document from a string containing XML

Parameters:
xmlString - String version of XML
Returns:
JDOM Document if file contents converted successfully, null otherwise
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


Copyright © 2012 Atlassian. All Rights Reserved.