Apache CXF API

org.apache.cxf.ws.security.wss4j.policyhandlers
Class AbstractBindingBuilder

java.lang.Object
  extended by org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder
Direct Known Subclasses:
AsymmetricBindingHandler, SymmetricBindingHandler, TransportBindingHandler

public abstract class AbstractBindingBuilder
extends Object


Field Summary
protected  AssertionInfoMap aim
           
protected  Binding binding
           
static String CRYPTO_CACHE
           
protected  Set<String> encryptedTokensIdList
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> endEncSuppTokMap
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> endSuppTokMap
           
protected  String mainSigId
           
protected  SoapMessage message
           
protected  SPConstants.ProtectionOrder protectionOrder
           
protected  javax.xml.soap.SOAPMessage saaj
           
static String SAMLTOKEN_NS11
           
protected  org.apache.ws.security.message.WSSecHeader secHeader
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> sgndEndEncSuppTokMap
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> sgndEndSuppTokMap
           
protected  Vector<byte[]> signatures
           
protected  org.apache.ws.security.message.WSSecTimestamp timestampEl
           
static String WSS_SAML_TOKEN_TYPE
           
static String WSS_SAML2_KI_VALUE_TYPE
           
static String WSS_SAML2_TOKEN_TYPE
           
 
Constructor Summary
AbstractBindingBuilder(Binding binding, javax.xml.soap.SOAPMessage saaj, org.apache.ws.security.message.WSSecHeader secHeader, AssertionInfoMap aim, SoapMessage message)
           
 
Method Summary
protected  void addDerivedKeyElement(Element el)
           
protected  void addEncyptedKeyElement(Element el)
           
protected  void addSignatureConfirmation(Vector<org.apache.ws.security.WSEncryptionPart> sigParts)
           
protected  void addSignatureParts(Map<Token,org.apache.ws.security.message.WSSecBase> tokenMap, List<org.apache.ws.security.WSEncryptionPart> sigParts)
           
protected  void addSupportingElement(Element el)
           
protected  void addSupportingTokens(Vector<org.apache.ws.security.WSEncryptionPart> sigs)
           
protected  void addTopDownElement(Element el)
           
protected  org.apache.ws.security.message.WSSecUsernameToken addUsernameToken(UsernameToken token)
           
 String addWsuIdToElement(Element elem)
          Generates a wsu:Id attribute for the provided Element and returns the attribute value or finds and returns the value of the attribute if it already exists.
protected  void assertSupportingTokens(Collection<PolicyAssertion> suppTokens)
           
protected  void assertSupportingTokens(Vector<org.apache.ws.security.WSEncryptionPart> sigs)
           
protected  Element cloneElement(Element el)
           
protected  org.apache.ws.security.message.WSSecTimestamp createTimestamp()
           
protected  void doEndorse()
           
protected  void doEndorsedSignatures(Map<Token,org.apache.ws.security.message.WSSecBase> tokenMap, boolean isTokenProtection, boolean isSigProtect)
           
protected  Collection<PolicyAssertion> findAndAssertPolicy(QName n)
           
 org.apache.ws.security.components.crypto.Crypto getCrypto(TokenWrapper wrapper, String cryptoKey, String propKey)
           
protected  Map<Object,org.apache.ws.security.components.crypto.Crypto> getCryptoCache()
           
protected  org.apache.ws.security.message.WSSecEncryptedKey getEncryptedKeyBuilder(TokenWrapper wrapper, Token token)
           
 Vector<org.apache.ws.security.WSEncryptionPart> getEncryptedParts()
           
 org.apache.ws.security.components.crypto.Crypto getEncryptionCrypto(TokenWrapper wrapper)
           
 Vector<org.apache.ws.security.WSEncryptionPart> getPartsAndElements(boolean sign, boolean includeBody, List<org.apache.ws.security.WSEncryptionPart> parts, List<String> xpaths, Map<String,String> namespaces, List<String> contentXpaths, Map<String,String> cnamespaces)
          Deprecated. Use getSignedParts() and getEncryptedParts() instead.
 String getPassword(String userName, PolicyAssertion info, int type)
           
protected  SecurityToken getSecurityToken()
           
protected  org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.WSSecSignatureHelper getSignatureBuider(TokenWrapper wrapper, Token token, boolean endorse)
           
 org.apache.ws.security.components.crypto.Crypto getSignatureCrypto(TokenWrapper wrapper)
           
 Vector<org.apache.ws.security.WSEncryptionPart> getSignedParts()
           
protected  TokenStore getTokenStore()
           
static String getUsername(Vector results)
          Scan through WSHandlerResult vector for a Username token and return the username if a Username Token found
protected  Wss10 getWss10()
           
 void handleEncryptedSignedHeaders(Vector<org.apache.ws.security.WSEncryptionPart> encryptedParts, Vector<org.apache.ws.security.WSEncryptionPart> signedParts)
          Processes the parts to be signed and reconfigures those parts that have already been encrypted.
protected  org.apache.ws.security.message.WSSecTimestamp handleLayout(org.apache.ws.security.message.WSSecTimestamp timestamp)
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> handleSupportingTokens(Collection<PolicyAssertion> tokens, boolean endorse)
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> handleSupportingTokens(SupportingToken suppTokens, boolean endorse)
           
protected  Map<Token,org.apache.ws.security.message.WSSecBase> handleSupportingTokens(SupportingToken suppTokens, boolean endorse, Map<Token,org.apache.ws.security.message.WSSecBase> ret)
           
protected  void insertBeforeBottomUp(Element el)
           
protected  boolean isRequestor()
           
protected  void policyAsserted(PolicyAssertion assertion)
           
protected  void policyAsserted(QName n)
           
protected  void policyNotAsserted(PolicyAssertion assertion, Exception reason)
           
protected  void policyNotAsserted(PolicyAssertion assertion, String reason)
           
 void setEncryptionUser(org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder, TokenWrapper token, boolean sign, org.apache.ws.security.components.crypto.Crypto crypto)
           
 void setKeyIdentifierType(org.apache.ws.security.message.WSSecBase secBase, TokenWrapper wrapper, Token token)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRYPTO_CACHE

public static final String CRYPTO_CACHE
See Also:
Constant Field Values

SAMLTOKEN_NS11

public static final String SAMLTOKEN_NS11
See Also:
Constant Field Values

WSS_SAML_TOKEN_TYPE

public static final String WSS_SAML_TOKEN_TYPE
See Also:
Constant Field Values

WSS_SAML2_TOKEN_TYPE

public static final String WSS_SAML2_TOKEN_TYPE
See Also:
Constant Field Values

WSS_SAML2_KI_VALUE_TYPE

public static final String WSS_SAML2_KI_VALUE_TYPE
See Also:
Constant Field Values

protectionOrder

protected SPConstants.ProtectionOrder protectionOrder

saaj

protected javax.xml.soap.SOAPMessage saaj

secHeader

protected org.apache.ws.security.message.WSSecHeader secHeader

aim

protected AssertionInfoMap aim

binding

protected Binding binding

message

protected SoapMessage message

timestampEl

protected org.apache.ws.security.message.WSSecTimestamp timestampEl

mainSigId

protected String mainSigId

encryptedTokensIdList

protected Set<String> encryptedTokensIdList

endEncSuppTokMap

protected Map<Token,org.apache.ws.security.message.WSSecBase> endEncSuppTokMap

endSuppTokMap

protected Map<Token,org.apache.ws.security.message.WSSecBase> endSuppTokMap

sgndEndEncSuppTokMap

protected Map<Token,org.apache.ws.security.message.WSSecBase> sgndEndEncSuppTokMap

sgndEndSuppTokMap

protected Map<Token,org.apache.ws.security.message.WSSecBase> sgndEndSuppTokMap

signatures

protected Vector<byte[]> signatures
Constructor Detail

AbstractBindingBuilder

public AbstractBindingBuilder(Binding binding,
                              javax.xml.soap.SOAPMessage saaj,
                              org.apache.ws.security.message.WSSecHeader secHeader,
                              AssertionInfoMap aim,
                              SoapMessage message)
Method Detail

addDerivedKeyElement

protected void addDerivedKeyElement(Element el)

addEncyptedKeyElement

protected void addEncyptedKeyElement(Element el)

addSupportingElement

protected void addSupportingElement(Element el)

insertBeforeBottomUp

protected void insertBeforeBottomUp(Element el)

addTopDownElement

protected void addTopDownElement(Element el)

isRequestor

protected boolean isRequestor()

policyNotAsserted

protected void policyNotAsserted(PolicyAssertion assertion,
                                 Exception reason)

policyNotAsserted

protected void policyNotAsserted(PolicyAssertion assertion,
                                 String reason)

policyAsserted

protected void policyAsserted(PolicyAssertion assertion)

policyAsserted

protected void policyAsserted(QName n)

findAndAssertPolicy

protected Collection<PolicyAssertion> findAndAssertPolicy(QName n)

getCryptoCache

protected final Map<Object,org.apache.ws.security.components.crypto.Crypto> getCryptoCache()

getTokenStore

protected final TokenStore getTokenStore()

createTimestamp

protected org.apache.ws.security.message.WSSecTimestamp createTimestamp()

handleLayout

protected org.apache.ws.security.message.WSSecTimestamp handleLayout(org.apache.ws.security.message.WSSecTimestamp timestamp)

assertSupportingTokens

protected void assertSupportingTokens(Collection<PolicyAssertion> suppTokens)

handleSupportingTokens

protected Map<Token,org.apache.ws.security.message.WSSecBase> handleSupportingTokens(Collection<PolicyAssertion> tokens,
                                                                                     boolean endorse)

handleSupportingTokens

protected Map<Token,org.apache.ws.security.message.WSSecBase> handleSupportingTokens(SupportingToken suppTokens,
                                                                                     boolean endorse)

handleSupportingTokens

protected Map<Token,org.apache.ws.security.message.WSSecBase> handleSupportingTokens(SupportingToken suppTokens,
                                                                                     boolean endorse,
                                                                                     Map<Token,org.apache.ws.security.message.WSSecBase> ret)

cloneElement

protected Element cloneElement(Element el)

getSecurityToken

protected SecurityToken getSecurityToken()

addSignatureParts

protected void addSignatureParts(Map<Token,org.apache.ws.security.message.WSSecBase> tokenMap,
                                 List<org.apache.ws.security.WSEncryptionPart> sigParts)

addUsernameToken

protected org.apache.ws.security.message.WSSecUsernameToken addUsernameToken(UsernameToken token)

getPassword

public String getPassword(String userName,
                          PolicyAssertion info,
                          int type)

addWsuIdToElement

public String addWsuIdToElement(Element elem)
Generates a wsu:Id attribute for the provided Element and returns the attribute value or finds and returns the value of the attribute if it already exists.

Parameters:
element - the Element to check/create the attribute on
Returns:
the generated or discovered wsu:Id attribute value

getEncryptedParts

public Vector<org.apache.ws.security.WSEncryptionPart> getEncryptedParts()
                                                                  throws javax.xml.soap.SOAPException
Throws:
javax.xml.soap.SOAPException

getSignedParts

public Vector<org.apache.ws.security.WSEncryptionPart> getSignedParts()
                                                               throws javax.xml.soap.SOAPException
Throws:
javax.xml.soap.SOAPException

getPartsAndElements

public Vector<org.apache.ws.security.WSEncryptionPart> getPartsAndElements(boolean sign,
                                                                           boolean includeBody,
                                                                           List<org.apache.ws.security.WSEncryptionPart> parts,
                                                                           List<String> xpaths,
                                                                           Map<String,String> namespaces,
                                                                           List<String> contentXpaths,
                                                                           Map<String,String> cnamespaces)
                                                                    throws javax.xml.soap.SOAPException
Deprecated. Use getSignedParts() and getEncryptedParts() instead.

Identifies the portions of the message to be signed/encrypted.

Parameters:
sign - whether the matches are to be signed or encrypted
includeBody - if the body should be included in the signature/encryption
parts - any WSEncryptionParts to match for signature or encryption as specified by WS-SP signed parts or encrypted parts. Parts without a name match all elements with the provided namespace.
xpaths - any XPath expressions to sign/encrypt matches
namespaces - namespace prefix to namespace mappings for XPath expressions in xpaths
contentXpaths - any XPath expressions to content encrypt
cnamespaces - namespace prefix to namespace mappings for XPath expressions in contentXpaths
Returns:
a configured vector of WSEncryptionParts suitable for processing by WSS4J
Throws:
javax.xml.soap.SOAPException - if there is an error extracting SOAP content from the SAAJ model

getEncryptedKeyBuilder

protected org.apache.ws.security.message.WSSecEncryptedKey getEncryptedKeyBuilder(TokenWrapper wrapper,
                                                                                  Token token)
                                                                           throws org.apache.ws.security.WSSecurityException
Throws:
org.apache.ws.security.WSSecurityException

getSignatureCrypto

public org.apache.ws.security.components.crypto.Crypto getSignatureCrypto(TokenWrapper wrapper)

getEncryptionCrypto

public org.apache.ws.security.components.crypto.Crypto getEncryptionCrypto(TokenWrapper wrapper)

getCrypto

public org.apache.ws.security.components.crypto.Crypto getCrypto(TokenWrapper wrapper,
                                                                 String cryptoKey,
                                                                 String propKey)

setKeyIdentifierType

public void setKeyIdentifierType(org.apache.ws.security.message.WSSecBase secBase,
                                 TokenWrapper wrapper,
                                 Token token)

setEncryptionUser

public void setEncryptionUser(org.apache.ws.security.message.WSSecEncryptedKey encrKeyBuilder,
                              TokenWrapper token,
                              boolean sign,
                              org.apache.ws.security.components.crypto.Crypto crypto)

getUsername

public static String getUsername(Vector results)
Scan through WSHandlerResult vector for a Username token and return the username if a Username Token found

Parameters:
results -
Returns:

getWss10

protected Wss10 getWss10()

getSignatureBuider

protected org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.WSSecSignatureHelper getSignatureBuider(TokenWrapper wrapper,
                                                                                                                         Token token,
                                                                                                                         boolean endorse)

doEndorsedSignatures

protected void doEndorsedSignatures(Map<Token,org.apache.ws.security.message.WSSecBase> tokenMap,
                                    boolean isTokenProtection,
                                    boolean isSigProtect)

assertSupportingTokens

protected void assertSupportingTokens(Vector<org.apache.ws.security.WSEncryptionPart> sigs)

addSupportingTokens

protected void addSupportingTokens(Vector<org.apache.ws.security.WSEncryptionPart> sigs)

doEndorse

protected void doEndorse()

addSignatureConfirmation

protected void addSignatureConfirmation(Vector<org.apache.ws.security.WSEncryptionPart> sigParts)

handleEncryptedSignedHeaders

public void handleEncryptedSignedHeaders(Vector<org.apache.ws.security.WSEncryptionPart> encryptedParts,
                                         Vector<org.apache.ws.security.WSEncryptionPart> signedParts)
Processes the parts to be signed and reconfigures those parts that have already been encrypted.

Parameters:
encryptedParts - the parts that have been encrypted
signedParts - the parts that are to be signed
Throws:
IllegalArgumentException - if an element in signedParts contains a WSEncryptionPart with a null id value and the WSEncryptionPart name value is not "Token"

Apache CXF API

Apache CXF