Class AbstractBindingBuilder
java.lang.Object
org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractCommonBindingHandler
org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder
- Direct Known Subclasses:
AsymmetricBindingHandler,SymmetricBindingHandler,TransportBindingHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.cxf.ws.policy.AssertionInfoMapprotected AbstractBindingprotected Elementprotected Elementprotected final CallbackLookupstatic final Stringprotected Set<WSEncryptionPart>protected Elementprotected static final Loggerprotected Stringprotected SOAPMessageprotected WSSecHeaderprotected List<WSEncryptionPart>protected booleanprotected WSSecTimestampprotected Elementprotected WSDocInfoprotected final WSSConfigFields inherited from class org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractCommonBindingHandler
message -
Constructor Summary
ConstructorsConstructorDescriptionAbstractBindingBuilder(WSSConfig config, AbstractBinding binding, SOAPMessage saaj, WSSecHeader secHeader, org.apache.cxf.ws.policy.AssertionInfoMap aim, org.apache.cxf.binding.soap.SoapMessage message) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected WSSecUsernameTokenaddDKUsernameToken(UsernameToken token, byte[] salt) protected voidprotected SamlAssertionWrapperaddSamlToken(SamlToken token) protected voidaddSig(byte[] val) protected voidaddSignatureConfirmation(List<WSEncryptionPart> sigParts) protected voidaddSignatureParts(List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> tokenList, List<WSEncryptionPart> sigParts) protected voidprotected voidprotected voidprotected WSSecUsernameTokenaddUsernameToken(UsernameToken token) addWsuIdToElement(Element element) Generates a wsu:Id attribute for the providedElementand returns the attribute value or finds and returns the value of the attribute if it already exists.protected ElementcloneElement(Element el) convertToEncryptionPart(Element element) Convert a DOM Element into a WSEncryptionPart, adding a (wsu:)Id if there is not one already.protected WSSecTimestampprotected voidprotected voiddoEndorsedSignatures(List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> tokenList, boolean isTokenProtection, boolean isSigProtect) protected StringfindIDFromSamlToken(Element samlToken) protected Cryptoprotected List<WSEncryptionPart>Identifies the portions of the message to be signed/encrypted.protected WSSecEncryptedKeygetEncryptedKeyBuilder(AbstractToken token, SecretKey symmetricKey) protected WSSecurityEngineResultprotected List<WSEncryptionPart>getParts(boolean sign, boolean includeBody, List<WSEncryptionPart> parts, List<Element> found) Identifies the portions of the message to be signed/encrypted.getPartsAndElements(boolean sign, boolean includeBody, List<WSEncryptionPart> parts, List<XPath> xpaths, List<XPath> contentXpaths) Identifies the portions of the message to be signed/encrypted.protected StringgetPassword(String userName, org.apache.neethi.Assertion info, int usage) protected WSSecSignaturegetSignatureBuilder(AbstractToken token, boolean attached, boolean endorse) getSignedParts(SupportingTokens supportingToken) protected final TokenStorestatic StringgetUsername(List<WSHandlerResult> results) Scan throughWSHandlerResultlist for a Username token and return the username if a Username Token foundvoidhandleEncryptedSignedHeaders(List<WSEncryptionPart> encryptedParts, List<WSEncryptionPart> signedParts) Processes the parts to be signed and reconfigures those parts that have already been encrypted.protected WSSecTimestamphandleLayout(WSSecTimestamp timestamp) protected List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken>handleSupportingTokens(SupportingTokens suppTokens, boolean endorse, List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> ret) protected voidhandleUsernameTokenSupportingToken(UsernameToken token, boolean endorse, boolean encryptedToken, List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> ret) protected voidinsertAfter(Element child, Element sib) protected voidbooleanprotected voidsetEncryptionUser(WSSecEncryptedKey encrKeyBuilder, AbstractToken token, boolean sign, Crypto crypto) voidsetKeyIdentifierType(WSSecBase secBase, AbstractToken token) protected voidStore a SAML Assertion as a SecurityTokenMethods inherited from class org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractCommonBindingHandler
assertAlgorithmSuite, assertPolicy, assertPolicy, assertToken, assertTokenWrapper, assertTrustProperties, assertWSSProperties, getAllAssertionsByLocalname, getMessage, getSecurityToken, getWss10, isRequestor, isTokenRequired, unassertPolicy, unassertPolicy
-
Field Details
-
CRYPTO_CACHE
- See Also:
-
LOG
-
protectionOrder
-
wssConfig
-
saaj
-
secHeader
-
aim
protected org.apache.cxf.ws.policy.AssertionInfoMap aim -
binding
-
timestampEl
-
mainSigId
-
sigConfList
-
encryptedTokensList
-
signatures
-
bottomUpElement
-
topDownElement
-
bstElement
-
lastEncryptedKeyElement
-
callbackLookup
-
storeBytesInAttachment
protected boolean storeBytesInAttachment -
wsDocInfo
-
-
Constructor Details
-
AbstractBindingBuilder
public AbstractBindingBuilder(WSSConfig config, AbstractBinding binding, SOAPMessage saaj, WSSecHeader secHeader, org.apache.cxf.ws.policy.AssertionInfoMap aim, org.apache.cxf.binding.soap.SoapMessage message) throws SOAPException - Throws:
SOAPException
-
-
Method Details
-
insertAfter
-
addDerivedKeyElement
-
addEncryptedKeyElement
-
addSupportingElement
-
insertBeforeBottomUp
-
addTopDownElement
-
getCryptoCache
-
getTokenStore
- Throws:
TokenStoreException
-
createTimestamp
-
handleLayout
-
reshuffleTimestamp
protected void reshuffleTimestamp() -
handleSupportingTokens
protected List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> handleSupportingTokens(SupportingTokens suppTokens, boolean endorse, List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> ret) throws WSSecurityException, SOAPException, TokenStoreException -
handleUsernameTokenSupportingToken
protected void handleUsernameTokenSupportingToken(UsernameToken token, boolean endorse, boolean encryptedToken, List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> ret) throws WSSecurityException - Throws:
WSSecurityException
-
cloneElement
-
addSignatureParts
protected void addSignatureParts(List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> tokenList, List<WSEncryptionPart> sigParts) -
addUsernameToken
-
addDKUsernameToken
-
addSamlToken
protected SamlAssertionWrapper addSamlToken(SamlToken token) throws WSSecurityException, TokenStoreException -
storeAssertionAsSecurityToken
protected void storeAssertionAsSecurityToken(SamlAssertionWrapper assertion) throws TokenStoreException Store a SAML Assertion as a SecurityToken- Throws:
TokenStoreException
-
findIDFromSamlToken
-
getPassword
-
addWsuIdToElement
Generates a wsu:Id attribute for the providedElementand returns the attribute value or finds and returns the value of the attribute if it already exists.- Parameters:
element- theElementto check/create the attribute on- Returns:
- the generated or discovered wsu:Id attribute value
-
getEncryptedParts
- Throws:
SOAPException
-
getSignedParts
- Throws:
SOAPException
-
getPartsAndElements
public List<WSEncryptionPart> getPartsAndElements(boolean sign, boolean includeBody, List<WSEncryptionPart> parts, List<XPath> xpaths, List<XPath> contentXpaths) throws SOAPException Identifies the portions of the message to be signed/encrypted.- Parameters:
sign- whether the matches are to be signed or encryptedincludeBody- if the body should be included in the signature/encryptionparts- anyWSEncryptionParts 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 matchescontentXpaths- any XPath expressions to content encrypt- Returns:
- a configured list of
WSEncryptionParts suitable for processing by WSS4J - Throws:
SOAPException- if there is an error extracting SOAP content from the SAAJ model
-
getParts
protected List<WSEncryptionPart> getParts(boolean sign, boolean includeBody, List<WSEncryptionPart> parts, List<Element> found) throws SOAPException Identifies the portions of the message to be signed/encrypted.- Parameters:
sign- whether the matches are to be signed or encryptedincludeBody- if the body should be included in the signature/encryptionparts- anyWSEncryptionParts 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.found- a list of elements that have previously been tagged for signing/encryption. Populated with additional matches found by this method and used to prevent including the same element twice under the same operation.- Returns:
- a configured list of
WSEncryptionParts suitable for processing by WSS4J - Throws:
SOAPException- if there is an error extracting SOAP content from the SAAJ model
-
getElements
protected List<WSEncryptionPart> getElements(String encryptionModifier, List<XPath> xpaths, List<Element> found, boolean forceId) throws SOAPException Identifies the portions of the message to be signed/encrypted.- Parameters:
encryptionModifier- indicates the scope of the crypto operation over matched elements. Either "Content" or "Element".xpaths- any XPath expressions to sign/encrypt matchesfound- a list of elements that have previously been tagged for signing/encryption. Populated with additional matches found by this method and used to prevent including the same element twice under the same operation.forceId- force adding a wsu:Id onto the elements. Recommended for signatures.- Returns:
- a configured list of
WSEncryptionParts suitable for processing by WSS4J - Throws:
SOAPException- if there is an error extracting SOAP content from the SAAJ model
-
getEncryptedKeyBuilder
protected WSSecEncryptedKey getEncryptedKeyBuilder(AbstractToken token, SecretKey symmetricKey) throws WSSecurityException - Throws:
WSSecurityException
-
getSignatureCrypto
- Throws:
WSSecurityException
-
getEncryptionCrypto
- Throws:
WSSecurityException
-
getCrypto
- Throws:
WSSecurityException
-
setKeyIdentifierType
-
setEncryptionUser
public String setEncryptionUser(WSSecEncryptedKey encrKeyBuilder, AbstractToken token, boolean sign, Crypto crypto) -
getUsername
Scan throughWSHandlerResultlist for a Username token and return the username if a Username Token found- Parameters:
results-- Returns:
-
getEncryptedKeyResult
-
getSignatureBuilder
protected WSSecSignature getSignatureBuilder(AbstractToken token, boolean attached, boolean endorse) throws WSSecurityException, TokenStoreException -
doEndorsedSignatures
protected void doEndorsedSignatures(List<org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.SupportingToken> tokenList, boolean isTokenProtection, boolean isSigProtect) -
addSupportingTokens
- Throws:
WSSecurityException
-
doEndorse
protected void doEndorse() -
addSignatureConfirmation
-
handleEncryptedSignedHeaders
public void handleEncryptedSignedHeaders(List<WSEncryptionPart> encryptedParts, List<WSEncryptionPart> signedParts) Processes the parts to be signed and reconfigures those parts that have already been encrypted.- Parameters:
encryptedParts- the parts that have been encryptedsignedParts- the parts that are to be signed- Throws:
IllegalArgumentException- if an element insignedPartscontains aWSEncryptionPartwith anullidvalue and theWSEncryptionPartnamevalue is not "Token"
-
convertToEncryptionPart
Convert a DOM Element into a WSEncryptionPart, adding a (wsu:)Id if there is not one already.- Parameters:
element- The DOM Element to convert- Returns:
- The WSEncryptionPart representing the DOM Element argument
-
addSig
protected void addSig(byte[] val) -
isExpandXopInclude
public boolean isExpandXopInclude()
-