com.sun.identity.saml2.common
Class SAML2SDKUtils

java.lang.Object
  extended bycom.sun.identity.saml2.common.SAML2SDKUtils

public class SAML2SDKUtils
extends java.lang.Object

The SAML2SDKUtils contains utility methods for SAML 2.0 implementation.


Field Summary
static java.lang.String ACTION
           
static java.lang.String ADVICE
           
static java.lang.String ARTIFACT
           
static java.lang.String ARTIFACT_RESOLVE
           
static java.lang.String ARTIFACT_RESPONSE
           
static java.lang.String ASSERTION
           
static java.lang.String ATTRIBUTE
           
static java.lang.String ATTRIBUTE_STATEMENT
           
static java.lang.String AUDIENCE_RESTRICTION
           
static java.lang.String AUTHN_CONTEXT
           
static java.lang.String AUTHN_REQUEST
           
static java.lang.String AUTHN_STATEMENT
           
static java.lang.String AUTHZ_DECISION_STATEMENT
           
static java.lang.String BASEID
           
static java.util.ResourceBundle bundle
           
static java.lang.String BUNDLE_NAME
           
static java.lang.String CONDITION
           
static java.lang.String CONDITIONS
           
static Debug debug
           
static java.lang.String ENCRYPTED_ASSERTION
           
static java.lang.String ENCRYPTED_ATTRIBUTE
           
static java.lang.String ENCRYPTED_ELEMENT
           
static java.lang.String ENCRYPTEDID
           
static java.lang.String EVIDENCE
           
static java.lang.String EXTENSIONS
           
static java.lang.String GET_COMPLETE
           
static java.lang.String IDPENTRY
           
static java.lang.String IDPLIST
           
static java.lang.String ISSUER
           
static java.lang.String KEYINFO_CONFIRMATION_DATA
           
static java.lang.String LOGOUT_REQUEST
           
static java.lang.String LOGOUT_RESPONSE
           
static java.lang.String MANAGE_NAMEID_REQUEST
           
static java.lang.String MANAGE_NAMEID_RESPONSE
           
static java.lang.String NAMEID
           
static java.lang.String NAMEID_POLICY
           
static java.lang.String NEW_ENCRYPTEDID
           
static java.lang.String NEWID
           
static java.lang.String ONE_TIME_USE
           
static java.lang.String PROXY_RESTRICTION
           
static java.security.SecureRandom random
           
static java.lang.String REQUESTED_AUTHN_CONTEXT
           
static java.lang.String REQUESTERID
           
static java.lang.String RESPONSE
           
static java.lang.String SCOPING
           
static java.lang.String SESSION_INDEX
           
static java.lang.String STATEMENT
           
static java.lang.String STATUS
           
static java.lang.String STATUS_CODE
           
static java.lang.String STATUS_DETAIL
           
static java.lang.String STATUS_MESSAGE
           
static java.lang.String STATUS_RESPONSE
           
static java.lang.String SUBJECT
           
static java.lang.String SUBJECT_CONFIRMATION
           
static java.lang.String SUBJECT_CONFIRMATION_DATA
           
static java.lang.String SUBJECT_LOCALITY
           
 
Constructor Summary
SAML2SDKUtils()
           
 
Method Summary
static java.lang.String byteArrayToHexString(byte[] byteArray)
          Converts byte array to Hex String.
static java.lang.String byteArrayToString(byte[] bytes)
          Converts byte array to String.
static boolean checkStatement(org.w3c.dom.Element element, java.lang.String statementname)
          Verifies if an element is a type of a specific statement.
static java.lang.String generateID()
          Generates ID.
static java.lang.String generateMessageHandle()
          Generates message handle used in an Artifact.
static java.lang.Object getObjectInstance(java.lang.String iName)
          Returns default object instance for a given interface.
static java.lang.Object getObjectInstance(java.lang.String iName, byte[] typecode, int endpointIndex, java.lang.String sourceID, java.lang.String messageHandle)
          Returns new object instance with given parameters.
static java.lang.Object getObjectInstance(java.lang.String iName, org.w3c.dom.Element value)
          Returns new object instance taking Element parameter in constructor.
static java.lang.Object getObjectInstance(java.lang.String iName, java.lang.String value)
          Returns new object instance taking String parameter in constructor.
static byte[] hexStringToByteArray(java.lang.String hexString)
          Converts Hex String to Byte Array.
static byte[] intToTwoBytes(int i)
          Converts integer to byte array.
static boolean isFM()
          Returns whether the existing installation is FM or AM.
static byte[] stringToByteArray(java.lang.String input)
          Converts String to Byte Array.
static int twoBytesToInt(byte[] bytes)
          Converts two bytes to an integer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static Debug debug

BUNDLE_NAME

public static final java.lang.String BUNDLE_NAME
See Also:
Constant Field Values

bundle

public static java.util.ResourceBundle bundle

random

public static java.security.SecureRandom random

ACTION

public static final java.lang.String ACTION
See Also:
Constant Field Values

ADVICE

public static final java.lang.String ADVICE
See Also:
Constant Field Values

ASSERTION

public static final java.lang.String ASSERTION
See Also:
Constant Field Values

ATTRIBUTE

public static final java.lang.String ATTRIBUTE
See Also:
Constant Field Values

ATTRIBUTE_STATEMENT

public static final java.lang.String ATTRIBUTE_STATEMENT
See Also:
Constant Field Values

AUDIENCE_RESTRICTION

public static final java.lang.String AUDIENCE_RESTRICTION
See Also:
Constant Field Values

AUTHN_CONTEXT

public static final java.lang.String AUTHN_CONTEXT
See Also:
Constant Field Values

AUTHN_STATEMENT

public static final java.lang.String AUTHN_STATEMENT
See Also:
Constant Field Values

AUTHZ_DECISION_STATEMENT

public static final java.lang.String AUTHZ_DECISION_STATEMENT
See Also:
Constant Field Values

BASEID

public static final java.lang.String BASEID
See Also:
Constant Field Values

CONDITION

public static final java.lang.String CONDITION
See Also:
Constant Field Values

CONDITIONS

public static final java.lang.String CONDITIONS
See Also:
Constant Field Values

ENCRYPTED_ASSERTION

public static final java.lang.String ENCRYPTED_ASSERTION
See Also:
Constant Field Values

ENCRYPTED_ATTRIBUTE

public static final java.lang.String ENCRYPTED_ATTRIBUTE
See Also:
Constant Field Values

ENCRYPTED_ELEMENT

public static final java.lang.String ENCRYPTED_ELEMENT
See Also:
Constant Field Values

ENCRYPTEDID

public static final java.lang.String ENCRYPTEDID
See Also:
Constant Field Values

EVIDENCE

public static final java.lang.String EVIDENCE
See Also:
Constant Field Values

ISSUER

public static final java.lang.String ISSUER
See Also:
Constant Field Values

KEYINFO_CONFIRMATION_DATA

public static final java.lang.String KEYINFO_CONFIRMATION_DATA
See Also:
Constant Field Values

NAMEID

public static final java.lang.String NAMEID
See Also:
Constant Field Values

ONE_TIME_USE

public static final java.lang.String ONE_TIME_USE
See Also:
Constant Field Values

PROXY_RESTRICTION

public static final java.lang.String PROXY_RESTRICTION
See Also:
Constant Field Values

STATEMENT

public static final java.lang.String STATEMENT
See Also:
Constant Field Values

SUBJECT_CONFIRMATION_DATA

public static final java.lang.String SUBJECT_CONFIRMATION_DATA
See Also:
Constant Field Values

SUBJECT_CONFIRMATION

public static final java.lang.String SUBJECT_CONFIRMATION
See Also:
Constant Field Values

SUBJECT

public static final java.lang.String SUBJECT
See Also:
Constant Field Values

SUBJECT_LOCALITY

public static final java.lang.String SUBJECT_LOCALITY
See Also:
Constant Field Values

ARTIFACT

public static final java.lang.String ARTIFACT
See Also:
Constant Field Values

ARTIFACT_RESOLVE

public static final java.lang.String ARTIFACT_RESOLVE
See Also:
Constant Field Values

ARTIFACT_RESPONSE

public static final java.lang.String ARTIFACT_RESPONSE
See Also:
Constant Field Values

AUTHN_REQUEST

public static final java.lang.String AUTHN_REQUEST
See Also:
Constant Field Values

EXTENSIONS

public static final java.lang.String EXTENSIONS
See Also:
Constant Field Values

GET_COMPLETE

public static final java.lang.String GET_COMPLETE
See Also:
Constant Field Values

IDPENTRY

public static final java.lang.String IDPENTRY
See Also:
Constant Field Values

IDPLIST

public static final java.lang.String IDPLIST
See Also:
Constant Field Values

LOGOUT_REQUEST

public static final java.lang.String LOGOUT_REQUEST
See Also:
Constant Field Values

LOGOUT_RESPONSE

public static final java.lang.String LOGOUT_RESPONSE
See Also:
Constant Field Values

MANAGE_NAMEID_REQUEST

public static final java.lang.String MANAGE_NAMEID_REQUEST
See Also:
Constant Field Values

MANAGE_NAMEID_RESPONSE

public static final java.lang.String MANAGE_NAMEID_RESPONSE
See Also:
Constant Field Values

NAMEID_POLICY

public static final java.lang.String NAMEID_POLICY
See Also:
Constant Field Values

NEW_ENCRYPTEDID

public static final java.lang.String NEW_ENCRYPTEDID
See Also:
Constant Field Values

NEWID

public static final java.lang.String NEWID
See Also:
Constant Field Values

REQUESTED_AUTHN_CONTEXT

public static final java.lang.String REQUESTED_AUTHN_CONTEXT
See Also:
Constant Field Values

REQUESTERID

public static final java.lang.String REQUESTERID
See Also:
Constant Field Values

RESPONSE

public static final java.lang.String RESPONSE
See Also:
Constant Field Values

SCOPING

public static final java.lang.String SCOPING
See Also:
Constant Field Values

SESSION_INDEX

public static final java.lang.String SESSION_INDEX
See Also:
Constant Field Values

STATUS_CODE

public static final java.lang.String STATUS_CODE
See Also:
Constant Field Values

STATUS_DETAIL

public static final java.lang.String STATUS_DETAIL
See Also:
Constant Field Values

STATUS

public static final java.lang.String STATUS
See Also:
Constant Field Values

STATUS_MESSAGE

public static final java.lang.String STATUS_MESSAGE
See Also:
Constant Field Values

STATUS_RESPONSE

public static final java.lang.String STATUS_RESPONSE
See Also:
Constant Field Values
Constructor Detail

SAML2SDKUtils

public SAML2SDKUtils()
Method Detail

getObjectInstance

public static java.lang.Object getObjectInstance(java.lang.String iName)
Returns default object instance for a given interface.

Parameters:
iName - name of the interface.
Returns:
object instance corresponding to the interface implementation. return null if the object instance could not be obtained.

getObjectInstance

public static java.lang.Object getObjectInstance(java.lang.String iName,
                                                 java.lang.String value)
Returns new object instance taking String parameter in constructor.

Parameters:
iName - name of the interface.
value - String value to be used as parameter in constructor.
Returns:
object instance corresponding to the interface implementation. return null if the object instance could not be obtained.

getObjectInstance

public static java.lang.Object getObjectInstance(java.lang.String iName,
                                                 org.w3c.dom.Element value)
Returns new object instance taking Element parameter in constructor.

Parameters:
iName - name of the interface.
value - Element value to be used as parameter in constructor.
Returns:
object instance corresponding to the interface implementation. return null if the object instance could not be obtained.

getObjectInstance

public static java.lang.Object getObjectInstance(java.lang.String iName,
                                                 byte[] typecode,
                                                 int endpointIndex,
                                                 java.lang.String sourceID,
                                                 java.lang.String messageHandle)
Returns new object instance with given parameters.

Parameters:
iName - name of the interface.
typecode - type code.
endpointIndex - end point index.
sourceID - source ID.
messageHandle - message handler.
Returns:
object instance corresponding to the interface implementation. return null if the object instance could not be obtained.

isFM

public static boolean isFM()
Returns whether the existing installation is FM or AM.

Returns:
true if the existing installation is FM, false if the installation is AM

checkStatement

public static boolean checkStatement(org.w3c.dom.Element element,
                                     java.lang.String statementname)
Verifies if an element is a type of a specific statement. Currently, this method is used by class AuthnStatementImpl, AuthzDecisionStatement and AttributeStatementImpl.

Parameters:
element - a DOM Element which needs to be verified.
statementname - A specific name of a statement, for example, AuthnStatement, AuthzStatement or AttributeStatement
Returns:
true if the element is of the specific type; false otherwise.

byteArrayToString

public static java.lang.String byteArrayToString(byte[] bytes)
Converts byte array to String.

Parameters:
bytes - Byte Array to be converted.
Returns:
result of the conversion.

intToTwoBytes

public static byte[] intToTwoBytes(int i)
                            throws SAML2Exception
Converts integer to byte array.

Parameters:
i - an integer value between 0 and 65535.
Returns:
a byte array whose length is 2.
Throws:
SAML2Exception - if the input is not between 0 and 65535.

twoBytesToInt

public static int twoBytesToInt(byte[] bytes)
                         throws SAML2Exception
Converts two bytes to an integer.

Parameters:
bytes - byte array whose length is 2.
Returns:
an integer value between 0 and 65535.
Throws:
SAML2Exception - if the input is null or the length is not 2.

generateMessageHandle

public static java.lang.String generateMessageHandle()
Generates message handle used in an Artifact.

Returns:
String format of 20-byte sequence identifying a message.

stringToByteArray

public static byte[] stringToByteArray(java.lang.String input)
Converts String to Byte Array.

Parameters:
input - String to be converted.
Returns:
result of the conversion.

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] byteArray)
Converts byte array to Hex String.

Parameters:
byteArray - Byte Array to be converted.
Returns:
result of the conversion.

hexStringToByteArray

public static byte[] hexStringToByteArray(java.lang.String hexString)
Converts Hex String to Byte Array.

Parameters:
hexString - Hex String to be converted.
Returns:
result of the conversion.

generateID

public static java.lang.String generateID()
Generates ID.

Returns:
ID value.


Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.