org.apache.rampart.util
Class RampartUtil

java.lang.Object
  extended byorg.apache.rampart.util.RampartUtil

public class RampartUtil
extends Object


Constructor Summary
RampartUtil()
           
 
Method Summary
static String addWsuIdToElement(org.apache.axiom.om.OMElement elem)
           
static Element appendChildToSecHeader(RampartMessageData rmd, Element elem)
           
static Element appendChildToSecHeader(RampartMessageData rmd, org.apache.axiom.om.OMElement elem)
           
static org.apache.axiom.om.OMElement createRSTTempalteForSCT(int conversationVersion, int wstVersion)
           
static String getContextIdentifierKey(org.apache.axis2.context.MessageContext msgContext)
          Creates the unique (reproducible) id for to hold the context identifier of the message exchange.
static Hashtable getContextMap(org.apache.axis2.context.MessageContext msgContext)
          Returns the map of security context token identifiers
static Vector getEncryptedParts(RampartMessageData rmd)
           
static org.apache.ws.security.components.crypto.Crypto getEncryptionCrypto(RampartConfig config, ClassLoader loader)
          Create the Crypto instance for encryption using information from the rampart configuration assertion
static KeyGenerator getEncryptionKeyGenerator(String symEncrAlgo)
           
static String getIssuedToken(RampartMessageData rmd, IssuedToken issuedToken)
          Obtain an issued token.
static int getKeyIdentifier(X509Token token)
          figureout the key identifier of a give X509Token
static CallbackHandler getPasswordCB(org.apache.axis2.context.MessageContext msgContext, RampartPolicyData rpd)
           
static CallbackHandler getPasswordCB(RampartMessageData rmd)
           
static String getRequestEncryptedKeyId(Vector results)
           
static byte[] getRequestEncryptedKeyValue(Vector results)
           
static String getSecConvToken(RampartMessageData rmd, SecureConversationToken secConvTok)
          Obtain a security context token.
static org.apache.ws.security.components.crypto.Crypto getSignatureCrypto(RampartConfig config, ClassLoader loader)
          Create the Crypto instance for signature using information from the rampart configuration assertion
static Vector getSignedParts(RampartMessageData rmd)
           
static String getSoapBodyId(org.apache.axiom.soap.SOAPEnvelope env)
           
static int getTimeToLive(RampartMessageData messageData)
           
static String getToken(RampartMessageData rmd, org.apache.axiom.om.OMElement rstTemplate, String issuerEpr, String action, org.apache.neethi.Policy issuerPolicy)
          Request a token.
static Element insertSiblingAfter(RampartMessageData rmd, Element child, Element sibling)
           
static Element insertSiblingBefore(RampartMessageData rmd, Element child, Element sibling)
           
static boolean isTokenValid(RampartMessageData rmd, String id)
           
static org.apache.ws.security.WSPasswordCallback performCallback(CallbackHandler cbHandler, String username, int doAction)
          Perform a callback to get a password.
static String processIssuerAddress(org.apache.axiom.om.OMElement issuerAddress)
          Process a give issuer address element and return the address.
static void setEncryptionUser(RampartMessageData rmd, org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RampartUtil

public RampartUtil()
Method Detail

getPasswordCB

public static CallbackHandler getPasswordCB(RampartMessageData rmd)
                                     throws RampartException
Throws:
RampartException

getPasswordCB

public static CallbackHandler getPasswordCB(org.apache.axis2.context.MessageContext msgContext,
                                            RampartPolicyData rpd)
                                     throws RampartException
Parameters:
msgContext -
rpd -
Returns:
The CallbackHandler instance
Throws:
RampartException

performCallback

public static org.apache.ws.security.WSPasswordCallback performCallback(CallbackHandler cbHandler,
                                                                        String username,
                                                                        int doAction)
                                                                 throws RampartException
Perform a callback to get a password.

The called back function gets an indication why to provide a password: to produce a UsernameToken, Signature, or a password (key) for a given name.

Throws:
RampartException

getEncryptionCrypto

public static org.apache.ws.security.components.crypto.Crypto getEncryptionCrypto(RampartConfig config,
                                                                                  ClassLoader loader)
                                                                           throws RampartException
Create the Crypto instance for encryption using information from the rampart configuration assertion

Parameters:
config -
Returns:
The Crypto instance to be used for encryption
Throws:
RampartException

getSignatureCrypto

public static org.apache.ws.security.components.crypto.Crypto getSignatureCrypto(RampartConfig config,
                                                                                 ClassLoader loader)
                                                                          throws RampartException
Create the Crypto instance for signature using information from the rampart configuration assertion

Parameters:
config -
Returns:
The Crypto instance to be used for signature
Throws:
RampartException

getKeyIdentifier

public static int getKeyIdentifier(X509Token token)
                            throws RampartException
figureout the key identifier of a give X509Token

Parameters:
token -
Returns:
The key identifier of a give X509Token
Throws:
RampartException

processIssuerAddress

public static String processIssuerAddress(org.apache.axiom.om.OMElement issuerAddress)
                                   throws RampartException
Process a give issuer address element and return the address.

Parameters:
issuerAddress -
Returns:
The address of an issuer address element
Throws:
RampartException - If the issuer address element is malformed.

createRSTTempalteForSCT

public static org.apache.axiom.om.OMElement createRSTTempalteForSCT(int conversationVersion,
                                                                    int wstVersion)
                                                             throws RampartException
Throws:
RampartException

getTimeToLive

public static int getTimeToLive(RampartMessageData messageData)

getSecConvToken

public static String getSecConvToken(RampartMessageData rmd,
                                     SecureConversationToken secConvTok)
                              throws TrustException,
                                     RampartException
Obtain a security context token.

Parameters:
rmd -
secConvTok -
Returns:
Return the SecurityContextidentifier of the token
Throws:
TrustException
RampartException

getIssuedToken

public static String getIssuedToken(RampartMessageData rmd,
                                    IssuedToken issuedToken)
                             throws RampartException
Obtain an issued token.

Parameters:
rmd -
issuedToken -
Returns:
The identifier of the issued token
Throws:
RampartException

getToken

public static String getToken(RampartMessageData rmd,
                              org.apache.axiom.om.OMElement rstTemplate,
                              String issuerEpr,
                              String action,
                              org.apache.neethi.Policy issuerPolicy)
                       throws RampartException
Request a token.

Parameters:
rmd -
rstTemplate -
issuerEpr -
action -
issuerPolicy -
Returns:
Return the identifier of the obtained token
Throws:
RampartException

getSoapBodyId

public static String getSoapBodyId(org.apache.axiom.soap.SOAPEnvelope env)

addWsuIdToElement

public static String addWsuIdToElement(org.apache.axiom.om.OMElement elem)

appendChildToSecHeader

public static Element appendChildToSecHeader(RampartMessageData rmd,
                                             org.apache.axiom.om.OMElement elem)

appendChildToSecHeader

public static Element appendChildToSecHeader(RampartMessageData rmd,
                                             Element elem)

insertSiblingAfter

public static Element insertSiblingAfter(RampartMessageData rmd,
                                         Element child,
                                         Element sibling)

insertSiblingBefore

public static Element insertSiblingBefore(RampartMessageData rmd,
                                          Element child,
                                          Element sibling)

getEncryptedParts

public static Vector getEncryptedParts(RampartMessageData rmd)

getSignedParts

public static Vector getSignedParts(RampartMessageData rmd)

getEncryptionKeyGenerator

public static KeyGenerator getEncryptionKeyGenerator(String symEncrAlgo)
                                              throws org.apache.ws.security.WSSecurityException
Throws:
org.apache.ws.security.WSSecurityException

getContextIdentifierKey

public static String getContextIdentifierKey(org.apache.axis2.context.MessageContext msgContext)
Creates the unique (reproducible) id for to hold the context identifier of the message exchange.

Returns:
Id to hold the context identifier in the message context

getContextMap

public static Hashtable getContextMap(org.apache.axis2.context.MessageContext msgContext)
Returns the map of security context token identifiers

Returns:
the map of security context token identifiers

isTokenValid

public static boolean isTokenValid(RampartMessageData rmd,
                                   String id)
                            throws RampartException
Throws:
RampartException

setEncryptionUser

public static void setEncryptionUser(RampartMessageData rmd,
                                     org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder)
                              throws RampartException
Throws:
RampartException

getRequestEncryptedKeyId

public static String getRequestEncryptedKeyId(Vector results)

getRequestEncryptedKeyValue

public static byte[] getRequestEncryptedKeyValue(Vector results)