public class RampartUtil extends Object
| Constructor and Description |
|---|
RampartUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.neethi.Policy |
addRampartConfig(RampartMessageData rmd,
org.apache.neethi.Policy policy) |
static String |
addWsuIdToElement(org.apache.axiom.om.OMElement elem) |
static Node |
adoptNode(Document targetDocument,
Node node)
Change the owner document of the given node.
|
static Element |
appendChildToSecHeader(RampartMessageData rmd,
Element elem) |
static Element |
appendChildToSecHeader(RampartMessageData rmd,
org.apache.axiom.om.OMElement elem) |
static boolean |
checkRequiredElements(org.apache.axiom.soap.SOAPEnvelope envelope,
HashMap decNamespaces,
String expression)
Get a element for SOAP
|
static org.apache.ws.security.WSEncryptionPart |
createEncryptionPart(String name,
String id)
Creates an Encryption or Signature paert with given name and id.
|
static org.apache.ws.security.WSEncryptionPart |
createEncryptionPart(String name,
String id,
String namespace,
String modifier)
Creates an encryption part.
|
static org.apache.ws.security.WSEncryptionPart |
createEncryptionPart(String name,
String id,
String namespace,
String modifier,
String xPath)
Creates an encryption part.
|
static org.apache.axiom.om.OMElement |
createRSTTempalteForSCT(int conversationVersion,
int wstVersion) |
static boolean |
encryptFirst(RampartPolicyData rpd)
Returns true if needed to encrypt first.
|
static Set |
findAllPrefixNamespaces(org.apache.axiom.om.OMElement currentElement,
HashMap decNamespacess) |
static List<org.apache.ws.security.WSEncryptionPart> |
getContentEncryptedElements(List<org.apache.ws.security.WSEncryptionPart> encryptedPartsElements,
org.apache.axiom.soap.SOAPEnvelope envelope,
List<String> elements,
HashMap decNamespaces) |
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 List<org.apache.ws.security.WSEncryptionPart> |
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 List<org.apache.ws.security.WSEncryptionPart> |
getPartsAndElements(boolean sign,
org.apache.axiom.soap.SOAPEnvelope envelope,
boolean includeBody,
List<org.apache.ws.security.WSEncryptionPart> parts,
List<String> elements,
HashMap decNamespaces) |
static CallbackHandler |
getPasswordCB(org.apache.axis2.context.MessageContext msgContext,
RampartPolicyData rpd) |
static CallbackHandler |
getPasswordCB(RampartMessageData rmd) |
static org.apache.neethi.Policy |
getPolicyFromMetadataRef(org.apache.axiom.om.OMElement mex)
Retrieve policy using metadata reference
<wsa:Metadata xmlns:wsa="http://www.w3.org/2005/08/addressing">
<mex:Metadata
xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mex:MetadataSection>
<mex:MetadataReference>
<wsa:Address>http://address/of/mex/service</wsa:Address>
</mex:MetadataReference>
</mex:MetadataSection>
</mex:Metadata>
</wsa:Metadata>
|
static PolicyValidatorCallbackHandler |
getPolicyValidatorCB(org.apache.axis2.context.MessageContext msgContext,
RampartPolicyData rpd)
Returns an instance of PolicyValidatorCallbackHandler to be used to validate ws-security results.
|
static RampartConfigCallbackHandler |
getRampartConfigCallbackHandler(org.apache.axis2.context.MessageContext msgContext,
RampartPolicyData rpd) |
static String |
getRequestEncryptedKeyId(List<org.apache.ws.security.handler.WSHandlerResult> results) |
static byte[] |
getRequestEncryptedKeyValue(List<org.apache.ws.security.handler.WSHandlerResult> results) |
static String |
getSAML10AssertionNamespace()
Returns SAML10 Assertion namespace.
|
static String |
getSecConvToken(RampartMessageData rmd,
SecureConversationToken secConvTok)
Obtain a security context token.
|
static String |
getSigElementId(RampartMessageData rmd) |
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 List<org.apache.ws.security.WSEncryptionPart> |
getSignedParts(RampartMessageData rmd) |
static String |
getSoapBodyId(org.apache.axiom.soap.SOAPEnvelope env) |
static List<org.apache.ws.security.WSEncryptionPart> |
getSupportingEncryptedParts(RampartMessageData rmd,
SupportingPolicyData rpd) |
static List<org.apache.ws.security.WSEncryptionPart> |
getSupportingSignedParts(RampartMessageData rmd,
SupportingPolicyData rpd) |
static int |
getTimestampMaxSkew(RampartMessageData messageData) |
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 String |
getUsername(List<org.apache.ws.security.handler.WSHandlerResult> results)
Scan through
WSHandlerResult list for a Username token and return
the username if a Username Token found |
static Collection<UsernameToken> |
getUsernameTokens(RampartPolicyData rpd) |
static Collection<UsernameToken> |
getUsernameTokens(SupportingToken suppTok) |
static org.apache.ws.security.WSSConfig |
getWSSConfigInstance()
We use this method to prevent the singleton behavior of WSSConfig
|
static void |
handleEncryptedSignedHeaders(List<org.apache.ws.security.WSEncryptionPart> encryptedParts,
List<org.apache.ws.security.WSEncryptionPart> signedParts,
Document doc) |
static Element |
insertSiblingAfter(RampartMessageData rmd,
Element child,
Element sibling) |
static Element |
insertSiblingAfterOrPrepend(RampartMessageData rmd,
Element child,
Element elem)
If the child is present insert the element as a sibling after him.
|
static Element |
insertSiblingBefore(RampartMessageData rmd,
Element child,
Element sibling) |
static Element |
insertSiblingBeforeOrPrepend(RampartMessageData rmd,
Element child,
Element elem) |
static boolean |
isSecHeaderRequired(RampartPolicyData rpd,
boolean initiator,
boolean inflow)
Method to check whether security header is required in incoming message
|
static boolean |
isSecurityFault(org.apache.axiom.soap.SOAPFault fault)
Check if the given SOAP fault reports a security fault.
|
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 |
setDecryptionCrypto(org.apache.axis2.context.MessageContext msgContext)
Sets decryption crypto file or crypto reference key to signature crypto file or signature
crypto reference.
|
static void |
setEncryptionCrypto(org.apache.axis2.context.MessageContext msgContext)
Sets encryption crypto file or crypto reference key to signature crypto file or signature
crypto reference.
|
static void |
setEncryptionUser(RampartMessageData rmd,
org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder) |
static void |
setEncryptionUser(RampartMessageData rmd,
org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder,
String encrUser) |
static void |
setKeyIdentifierType(RampartMessageData rmd,
org.apache.ws.security.message.WSSecBase secBase,
Token token)
Sets the keyIdentifierType of
WSSecSignature or WSSecEncryptedKey
according to the given Token and RampartPolicyData
First check the requirements specified under Token Assertion and if not found check
the WSS11 and WSS10 assertions |
static void |
validateTransport(RampartMessageData rmd) |
public static CallbackHandler getPasswordCB(RampartMessageData rmd) throws RampartException
RampartExceptionpublic static CallbackHandler getPasswordCB(org.apache.axis2.context.MessageContext msgContext, RampartPolicyData rpd) throws RampartException
msgContext - rpd - CallbackHandler instanceRampartExceptionpublic static PolicyValidatorCallbackHandler getPolicyValidatorCB(org.apache.axis2.context.MessageContext msgContext, RampartPolicyData rpd) throws RampartException
msgContext - MessageContextrpd - RampartPolicyDataPolicyValidatorCallbackHandlerRampartException - RampartExceptionpublic static RampartConfigCallbackHandler getRampartConfigCallbackHandler(org.apache.axis2.context.MessageContext msgContext, RampartPolicyData rpd) throws RampartException
RampartExceptionpublic static org.apache.ws.security.WSPasswordCallback performCallback(CallbackHandler cbHandler, String username, int doAction) throws RampartException
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.
RampartExceptionpublic static org.apache.ws.security.components.crypto.Crypto getEncryptionCrypto(RampartConfig config, ClassLoader loader) throws RampartException
Crypto instance for encryption using information
from the rampart configuration assertionconfig - Crypto instance to be used for encryptionRampartExceptionpublic static org.apache.ws.security.components.crypto.Crypto getSignatureCrypto(RampartConfig config, ClassLoader loader) throws RampartException
Crypto instance for signature using information
from the rampart configuration assertionconfig - Crypto instance to be used for signatureRampartExceptionpublic static int getKeyIdentifier(X509Token token) throws RampartException
token - RampartExceptionpublic static String processIssuerAddress(org.apache.axiom.om.OMElement issuerAddress) throws RampartException
issuerAddress - RampartException - If the issuer address element is malformed.public static org.apache.neethi.Policy getPolicyFromMetadataRef(org.apache.axiom.om.OMElement mex)
throws RampartException
<wsa:Metadata xmlns:wsa="http://www.w3.org/2005/08/addressing">
<mex:Metadata
xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mex:MetadataSection>
<mex:MetadataReference>
<wsa:Address>http://address/of/mex/service</wsa:Address>
</mex:MetadataReference>
</mex:MetadataSection>
</mex:Metadata>
</wsa:Metadata>mex - Metadata elementRampartExceptionpublic static org.apache.neethi.Policy addRampartConfig(RampartMessageData rmd, org.apache.neethi.Policy policy)
public static org.apache.axiom.om.OMElement createRSTTempalteForSCT(int conversationVersion,
int wstVersion)
throws RampartException
RampartExceptionpublic static int getTimeToLive(RampartMessageData messageData)
public static int getTimestampMaxSkew(RampartMessageData messageData)
public static String getSecConvToken(RampartMessageData rmd, SecureConversationToken secConvTok) throws TrustException, RampartException
rmd - secConvTok - TrustExceptionRampartExceptionpublic static String getIssuedToken(RampartMessageData rmd, IssuedToken issuedToken) throws RampartException
rmd - issuedToken - RampartExceptionpublic static String getToken(RampartMessageData rmd, org.apache.axiom.om.OMElement rstTemplate, String issuerEpr, String action, org.apache.neethi.Policy issuerPolicy) throws RampartException
rmd - rstTemplate - issuerEpr - action - issuerPolicy - RampartExceptionpublic static String getSoapBodyId(org.apache.axiom.soap.SOAPEnvelope env)
public static String addWsuIdToElement(org.apache.axiom.om.OMElement elem)
public static Node adoptNode(Document targetDocument, Node node)
Document.adoptNode(Node). If that fails, it will import the node into the target
document using Document.importNode(Node, boolean).targetDocument - the target documentnode - the node to adopt or importpublic static Element appendChildToSecHeader(RampartMessageData rmd, org.apache.axiom.om.OMElement elem)
public static Element appendChildToSecHeader(RampartMessageData rmd, Element elem)
public static Element insertSiblingAfter(RampartMessageData rmd, Element child, Element sibling)
public static Element insertSiblingBefore(RampartMessageData rmd, Element child, Element sibling)
public static List<org.apache.ws.security.WSEncryptionPart> getEncryptedParts(RampartMessageData rmd)
public static List<org.apache.ws.security.WSEncryptionPart> getSignedParts(RampartMessageData rmd)
public static List<org.apache.ws.security.WSEncryptionPart> getSupportingEncryptedParts(RampartMessageData rmd, SupportingPolicyData rpd)
public static List<org.apache.ws.security.WSEncryptionPart> getSupportingSignedParts(RampartMessageData rmd, SupportingPolicyData rpd)
public static Set findAllPrefixNamespaces(org.apache.axiom.om.OMElement currentElement, HashMap decNamespacess)
public static List<org.apache.ws.security.WSEncryptionPart> getContentEncryptedElements(List<org.apache.ws.security.WSEncryptionPart> encryptedPartsElements, org.apache.axiom.soap.SOAPEnvelope envelope, List<String> elements, HashMap decNamespaces)
public static org.apache.ws.security.WSEncryptionPart createEncryptionPart(String name, String id)
name - The name of the partid - The id of the part.public static org.apache.ws.security.WSEncryptionPart createEncryptionPart(String name, String id, String namespace, String modifier)
name - Name of the element.id - The id of the elementnamespace - Namespace of the element.modifier - Modifier "Content" or "Element"public static org.apache.ws.security.WSEncryptionPart createEncryptionPart(String name, String id, String namespace, String modifier, String xPath)
name - Name of the element.id - The id of the elementnamespace - Namespace of the element.modifier - Modifier "Content" or "Element"xPath - The xPath expressionpublic static List<org.apache.ws.security.WSEncryptionPart> getPartsAndElements(boolean sign, org.apache.axiom.soap.SOAPEnvelope envelope, boolean includeBody, List<org.apache.ws.security.WSEncryptionPart> parts, List<String> elements, HashMap decNamespaces)
public static boolean checkRequiredElements(org.apache.axiom.soap.SOAPEnvelope envelope,
HashMap decNamespaces,
String expression)
envelope - SOAP Envelope of which we should check required elementsdecNamespaces - Declared namespaces in RequiredElements assertionexpression - XPATH expression of required elementspublic static KeyGenerator getEncryptionKeyGenerator(String symEncrAlgo) throws org.apache.ws.security.WSSecurityException
org.apache.ws.security.WSSecurityExceptionpublic static String getContextIdentifierKey(org.apache.axis2.context.MessageContext msgContext)
public static Hashtable getContextMap(org.apache.axis2.context.MessageContext msgContext)
public static boolean isTokenValid(RampartMessageData rmd, String id) throws RampartException
RampartExceptionpublic static void setEncryptionUser(RampartMessageData rmd, org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder) throws RampartException
RampartExceptionpublic static void setEncryptionUser(RampartMessageData rmd, org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder, String encrUser) throws RampartException
RampartExceptionpublic static void setKeyIdentifierType(RampartMessageData rmd, org.apache.ws.security.message.WSSecBase secBase, Token token)
WSSecSignature or WSSecEncryptedKey
according to the given Token and RampartPolicyData
First check the requirements specified under Token Assertion and if not found check
the WSS11 and WSS10 assertionspublic static String getUsername(List<org.apache.ws.security.handler.WSHandlerResult> results)
WSHandlerResult list for a Username token and return
the username if a Username Token foundresults - public static String getRequestEncryptedKeyId(List<org.apache.ws.security.handler.WSHandlerResult> results)
public static byte[] getRequestEncryptedKeyValue(List<org.apache.ws.security.handler.WSHandlerResult> results)
public static Element insertSiblingAfterOrPrepend(RampartMessageData rmd, Element child, Element elem)
rmd - child - elem - - element mentioned abovepublic static Element insertSiblingBeforeOrPrepend(RampartMessageData rmd, Element child, Element elem)
public static boolean isSecHeaderRequired(RampartPolicyData rpd, boolean initiator, boolean inflow)
rpd - public static void handleEncryptedSignedHeaders(List<org.apache.ws.security.WSEncryptionPart> encryptedParts, List<org.apache.ws.security.WSEncryptionPart> signedParts, Document doc)
public static String getSigElementId(RampartMessageData rmd)
public static org.apache.ws.security.WSSConfig getWSSConfigInstance()
public static void validateTransport(RampartMessageData rmd) throws RampartException
RampartExceptionpublic static String getSAML10AssertionNamespace()
public static void setEncryptionCrypto(org.apache.axis2.context.MessageContext msgContext)
msgContext - The message context to get signature crypto properties and encryption properties
will be set to same message context.public static void setDecryptionCrypto(org.apache.axis2.context.MessageContext msgContext)
msgContext - The message context to get signature crypto properties and decryption properties
will be set to same message context.public static boolean encryptFirst(RampartPolicyData rpd)
rpd - Rampart policy datapublic static boolean isSecurityFault(org.apache.axiom.soap.SOAPFault fault)
fault - the SOAP fault; must not be nulltrue if the fault is a security fault; false otherwisepublic static Collection<UsernameToken> getUsernameTokens(RampartPolicyData rpd)
rpd - Rampart policy data instance. Must not be null.UsernameToken supporting token assertions in the specified Rampart policy instance. The method will check the following lists:
RampartPolicyData.getSupportingTokensList()RampartPolicyData.getSignedSupportingTokens()RampartPolicyData.getSignedEndorsingSupportingTokens()RampartPolicyData.getEndorsingSupportingTokens()RampartPolicyData.getEncryptedSupportingTokens()RampartPolicyData.getSignedEncryptedSupportingTokens()RampartPolicyData.getEndorsingEncryptedSupportingTokens()RampartPolicyData.getSignedEndorsingEncryptedSupportingTokens()public static Collection<UsernameToken> getUsernameTokens(SupportingToken suppTok)
suppTok - The SupportingToken assertion to check for username tokens.suppTok SupportingToken assertion which are instances of UsernameToken.
If the specified suppTok SupportingToken assertion is null, an empty collection will be returned.Copyright © Apache Software Foundation. All Rights Reserved.