public class SAML2SDKUtils extends Object
SAML2SDKUtils
contains utility methods for SAML 2.0
implementation.Modifier | Constructor and Description |
---|---|
protected |
SAML2SDKUtils()
Protected contstructor.
|
Modifier and Type | Method and Description |
---|---|
static Boolean |
booleanValueOf(String value)
Returns the boolean value as a
Boolean object. |
static String |
byteArrayToHexString(byte[] byteArray)
Converts byte array to
Hex String. |
static String |
byteArrayToString(byte[] bytes)
Converts byte array to String.
|
static boolean |
checkStatement(Element element,
String statementname)
Verifies if an element is a type of a specific statement.
|
static String |
createSOAPMessageString(String xmlString)
Creates
SOAPMessage with the input XML String
as message body. |
static void |
decodeXMLToDebugLog(String callerName,
Element xmlElement)
If enabled, decodes the provided XML element and prints it out to the decryption debug log.
|
static String |
fillInBasicAuthInfo(JAXBElement<BaseConfigType> config,
String locationURL)
Fills in basic auth user and password inside the location URL
if configuration is done properly
|
static String |
generateID()
Generates ID.
|
static String |
generateMessageHandle()
Generates message handle used in an
Artifact . |
static List |
getDiscoveryBootStrapCredentials(javax.servlet.http.HttpServletRequest request)
Gets the Discovery bootstrap credentials.
|
static ResourceOffering |
getDiscoveryBootStrapResourceOffering(javax.servlet.http.HttpServletRequest request)
Gets the Discovery bootstrap resource offering in an attribute
statement.
|
static Object |
getObjectInstance(String iName)
Returns default object instance for a given interface.
|
static Object |
getObjectInstance(String iName,
byte[] typecode,
int endpointIndex,
String sourceID,
String messageHandle)
Returns new object instance with given parameters.
|
static Object |
getObjectInstance(String iName,
Element value)
Returns new object instance taking Element parameter in constructor.
|
static Object |
getObjectInstance(String iName,
String value)
Returns new object instance taking String parameter in constructor.
|
static byte[] |
hexStringToByteArray(String hexString)
Converts
Hex String to Byte Array. |
static byte[] |
intToTwoBytes(int i)
Converts integer to byte array.
|
static boolean |
isSAMLDecryptionDebugEnabled()
Tells whether SAML SP decryption debug mode is enabled.
|
static String |
removeDeployUri(String uri)
Removes deployment URI from the pass down string.
|
static Boolean |
StringToBoolean(String str)
Converts a value of XML boolean type to Boolean object.
|
static byte[] |
stringToByteArray(String input)
Converts String to Byte Array.
|
static int |
twoBytesToInt(byte[] bytes)
Converts two bytes to an integer.
|
public static Object getObjectInstance(String iName)
iName
- name of the interface.public static Object getObjectInstance(String iName, String value)
iName
- name of the interface.value
- String value to be used as parameter in constructor.public static Object getObjectInstance(String iName, Element value)
iName
- name of the interface.value
- Element value to be used as parameter in constructor.public static Object getObjectInstance(String iName, byte[] typecode, int endpointIndex, String sourceID, String messageHandle)
iName
- name of the interface.typecode
- type code.endpointIndex
- end point index.sourceID
- source ID.messageHandle
- message handler.public static boolean checkStatement(Element element, String statementname)
element
- a DOM Element which needs to be verified.statementname
- A specific name of a statement, for example,
AuthnStatement, AuthzStatement or AttributeStatementtrue
if the element is of the specific type;
false
otherwise.public static String byteArrayToString(byte[] bytes)
bytes
- Byte Array to be converted.public static byte[] intToTwoBytes(int i) throws SAML2Exception
i
- an integer value between 0 and 65535.SAML2Exception
- if the input is not between 0 and 65535.public static int twoBytesToInt(byte[] bytes) throws SAML2Exception
bytes
- byte array whose length is 2.SAML2Exception
- if the input is null or the length is not 2.public static String generateMessageHandle()
Artifact
.public static byte[] stringToByteArray(String input)
input
- String to be converted.public static String byteArrayToHexString(byte[] byteArray)
Hex
String.byteArray
- Byte Array to be converted.public static byte[] hexStringToByteArray(String hexString)
Hex
String to Byte Array.hexString
- Hex
String to be converted.public static String generateID()
public static ResourceOffering getDiscoveryBootStrapResourceOffering(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest
associated with a user
session.ResourceOffering
Discovery Resource Offering,
null if there is any failure or if there is not onepublic static List getDiscoveryBootStrapCredentials(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequest
associated with a user
session.List
of SecurityAssertions
,
null if there is any failure or if there is not onepublic static String createSOAPMessageString(String xmlString) throws SOAPException, SAML2Exception
SOAPMessage
with the input XML String
as message body.xmlString
- XML string to be put into SOAPMessage
body.SOAPMessage
.SOAPException
- if it cannot create the
SOAPMessage
.SAML2Exception
public static String fillInBasicAuthInfo(JAXBElement<BaseConfigType> config, String locationURL)
config
- Either an SPSSOConfigElement object , an
IDPSSOConfigElement object or PEPConfigElement.locationURL
- The original location URL which is to be
inserted with user:password@ before the
hostname part and after //public static Boolean StringToBoolean(String str) throws SAML2Exception
str
- a value of XML boolean typeSAML2Exception
- if there is a syntax errorpublic static String removeDeployUri(String uri)
uri
- the URI string which the deployment uri is to be removed
return string without deployment uripublic static Boolean booleanValueOf(String value)
Boolean
object.value
- boolean value true or false.public static void decodeXMLToDebugLog(String callerName, Element xmlElement)
callerName
- String representing the name of the calling method.xmlElement
- String representing an XML document with decrypted
data.public static boolean isSAMLDecryptionDebugEnabled()
true
if SAML decryption debug mode is enabled, or false
otherwise or if the
property is not found.Copyright © 2010-2018, ForgeRock All Rights Reserved.