Package org.apache.cxf.ws.security.trust
Class AbstractSTSClient
java.lang.Object
org.apache.cxf.ws.security.trust.AbstractSTSClient
- All Implemented Interfaces:
org.apache.cxf.configuration.Configurable,org.apache.cxf.interceptor.InterceptorProvider
- Direct Known Subclasses:
STSClient
public abstract class AbstractSTSClient
extends Object
implements org.apache.cxf.configuration.Configurable, org.apache.cxf.interceptor.InterceptorProvider
An abstract class with some functionality to invoke on a SecurityTokenService (STS) via the
WS-Trust protocol.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Objectprotected Stringprotected org.apache.wss4j.policy.model.AlgorithmSuiteprotected booleanprotected booleanprotected org.apache.cxf.Busprotected Objectprotected CallbackHandlerprotected org.apache.cxf.endpoint.Clientprotected Stringprotected Objectprotected booleanprotected booleanprotected QNameprotected List<org.apache.cxf.feature.Feature>protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>protected booleanprotected booleanprotected intprotected Stringprotected Stringprotected org.apache.cxf.message.Messageprotected Stringprotected Stringprotected Objectprotected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>protected org.apache.neethi.Policyprotected booleanprotected booleanprotected booleanprotected QNameprotected Stringprotected Elementprotected org.apache.cxf.configuration.jsse.TLSClientParametersprotected Stringprotected intprotected booleanprotected X509Certificateprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAppliesTo(XMLStreamWriter writer, String appliesTo) protected voidaddBinaryExchange(String binaryExchange, org.apache.cxf.staxutils.W3CDOMStreamWriter writer) protected voidaddClaims(XMLStreamWriter writer) protected voidaddKeySize(int keysize, org.apache.cxf.staxutils.W3CDOMStreamWriter writer) protected voidaddLifetime(XMLStreamWriter writer) protected voidaddRequestType(String requestType, org.apache.cxf.staxutils.W3CDOMStreamWriter writer) protected voidaddTokenType(XMLStreamWriter writer) protected AbstractSTSClient.STSResponsecancel(SecurityToken token) Make an "Cancel" invocation and return the response as a STSResponse ObjectvoidconfigureViaEPR(org.apache.cxf.ws.addressing.EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation) protected voidprotected org.apache.wss4j.common.crypto.CryptocreateCrypto(boolean decrypt) protected CallbackHandlerprotected SecurityTokencreateSecurityToken(Element el, byte[] requestorEntropy) protected byte[]decryptKey(Element child) protected Stringprotected StringfindMEXLocation(org.apache.cxf.ws.addressing.EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation) protected StringfindMEXLocation(Element ref) protected org.apache.cxf.service.model.BindingOperationInfofindOperation(String suffix) Get the "ActAs" element to be sent to the STS.protected org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionprotected X509CertificategetCert(org.apache.wss4j.common.crypto.Crypto crypto) org.apache.cxf.endpoint.ClientGet some custom Element to be inserted into the RequestSecurityTokenprotected ElementgetDelegationSecurityToken(Object delegationObject) protected ElementList<org.apache.cxf.feature.Feature>protected StringgetIDFromSTR(Element el) List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>intGet the "OnBehalfOf" element to be sent to the STS.List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>>protected ObjectbooleanbooleanbooleanbooleanbooleanbooleanisSpnego()protected AbstractSTSClient.STSResponseMake an "Issue" invocation and return the response as a STSResponse Objectbooleanrenew(SecurityToken tok) Make an "Renew" invocation and return the response as a STSResponse ObjectvoidvoidvoidsetAlgorithmSuite(org.apache.wss4j.policy.model.AlgorithmSuite ag) voidsetAllowRenewing(boolean allowRenewing) voidsetAllowRenewingAfterExpiry(boolean allowRenewingAfterExpiry) voidvoidSet a Claims Object to be included in the request.voidsetClaimsCallbackHandler(CallbackHandler claimsCallbackHandler) voidsetContext(String context) voidsetCustomContent(Object customContent) voidsetEnableAppliesTo(boolean enableAppliesTo) voidsetEnableLifetime(boolean enableLifetime) voidvoidvoidsetFeatures(List<? extends org.apache.cxf.feature.Feature> f) voidsetInFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) voidsetInInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) voidsetKeySize(int i) voidsetKeyType(String keyType) voidsetLocation(String location) voidsetMessage(org.apache.cxf.message.Message message) voidsetNamespace(String namespace) voidsetOnBehalfOf(Object onBehalfOf) voidsetOutFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) voidsetOutInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) voidSets the WS-P policy that is applied to communications between this client and the remote server if no value is supplied forsetWsdlLocation(String).protected voidsetPolicyInternal(String policyReference) protected voidsetPolicyInternal(org.apache.neethi.Policy newPolicy) protected voidsetPolicyInternal(Element newPolicy) voidsetProperties(Map<String, Object> p) voidsetRequiresEntropy(boolean requiresEntropy) voidsetSecureConv(boolean secureConv) voidsetSendKeyType(boolean sendKeyType) voidsetSendRenewing(boolean sendRenewing) voidsetServiceName(String qn) voidsetServiceQName(QName qn) voidvoidsetSoap11(boolean b) voidvoidsetSpnego(boolean spnego) voidsetTemplate(Element rstTemplate) voidsetTlsClientParameters(org.apache.cxf.configuration.jsse.TLSClientParameters tlsClientParameters) voidsetTokenType(String tokenType) voidsetTrust(org.apache.wss4j.policy.model.Trust10 trust) voidsetTtl(int ttl) voidsetUseCertificateForConfirmationKeyInfo(boolean useCertificate) Indicate whether to use the signer's public X509 certificate for the subject confirmation key info when creating a RequestsSecurityToken message.voidsetUseKeyCertificate(X509Certificate useKeyCertificate) voidsetWsdlLocation(String wsdl) voidsetWspNamespace(String wspNamespace) protected booleanprotected AbstractSTSClient.STSResponsevalidate(SecurityToken tok, String tokentype) Make an "Validate" invocation and return the response as a STSResponse Objectprotected voidwriteElementsForRSTPublicKey(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, X509Certificate cert) protected byte[]writeElementsForRSTSymmetricKey(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, boolean wroteKeySize) protected StringwriteKeyType(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, String keyTypeToWrite)
-
Field Details
-
bus
protected org.apache.cxf.Bus bus -
name
-
client
protected org.apache.cxf.endpoint.Client client -
location
-
wsdlLocation
-
serviceName
-
endpointName
-
policy
protected org.apache.neethi.Policy policy -
soapVersion
-
keySize
protected int keySize -
requiresEntropy
protected boolean requiresEntropy -
template
-
customContent
-
claims
-
claimsCallbackHandler
-
algorithmSuite
protected org.apache.wss4j.policy.model.AlgorithmSuite algorithmSuite -
namespace
-
addressingNamespace
-
wspNamespace
-
onBehalfOf
-
enableAppliesTo
protected boolean enableAppliesTo -
useCertificateForConfirmationKeyInfo
protected boolean useCertificateForConfirmationKeyInfo -
isSecureConv
protected boolean isSecureConv -
isSpnego
protected boolean isSpnego -
enableLifetime
protected boolean enableLifetime -
ttl
protected int ttl -
sendRenewing
protected boolean sendRenewing -
allowRenewing
protected boolean allowRenewing -
allowRenewingAfterExpiry
protected boolean allowRenewingAfterExpiry -
actAs
-
tokenType
-
keyType
-
sendKeyType
protected boolean sendKeyType -
message
protected org.apache.cxf.message.Message message -
context
-
useKeyCertificate
-
ctx
-
in
-
out
protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> out -
outFault
protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> outFault -
inFault
protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> inFault -
features
-
tlsClientParameters
protected org.apache.cxf.configuration.jsse.TLSClientParameters tlsClientParameters
-
-
Constructor Details
-
AbstractSTSClient
public AbstractSTSClient(org.apache.cxf.Bus b)
-
-
Method Details
-
getBeanName
- Specified by:
getBeanNamein interfaceorg.apache.cxf.configuration.Configurable
-
setBeanName
-
getLocation
-
setLocation
-
setMessage
public void setMessage(org.apache.cxf.message.Message message) -
setTtl
public void setTtl(int ttl) -
setEnableLifetime
public void setEnableLifetime(boolean enableLifetime) -
setSendRenewing
public void setSendRenewing(boolean sendRenewing) -
setTlsClientParameters
public void setTlsClientParameters(org.apache.cxf.configuration.jsse.TLSClientParameters tlsClientParameters) -
setPolicy
Sets the WS-P policy that is applied to communications between this client and the remote server if no value is supplied forsetWsdlLocation(String). AcceptsPolicyorElementas input.- Parameters:
newPolicy- the policy object- Throws:
IllegalArgumentException- ifnewPolicyis not one of the supported types.
-
setSoap12
public void setSoap12() -
setSoap11
public void setSoap11() -
setSoap11
public void setSoap11(boolean b) -
setAddressingNamespace
-
setTrust
public void setTrust(org.apache.wss4j.policy.model.Trust10 trust) -
isRequiresEntropy
public boolean isRequiresEntropy() -
setRequiresEntropy
public void setRequiresEntropy(boolean requiresEntropy) -
isSecureConv
public boolean isSecureConv() -
setSecureConv
public void setSecureConv(boolean secureConv) -
isSpnego
public boolean isSpnego() -
setSpnego
public void setSpnego(boolean spnego) -
isAllowRenewing
public boolean isAllowRenewing() -
setAllowRenewing
public void setAllowRenewing(boolean allowRenewing) -
isAllowRenewingAfterExpiry
public boolean isAllowRenewingAfterExpiry() -
setAllowRenewingAfterExpiry
public void setAllowRenewingAfterExpiry(boolean allowRenewingAfterExpiry) -
isEnableAppliesTo
public boolean isEnableAppliesTo() -
setEnableAppliesTo
public void setEnableAppliesTo(boolean enableAppliesTo) -
getContext
-
setContext
-
setAlgorithmSuite
public void setAlgorithmSuite(org.apache.wss4j.policy.model.AlgorithmSuite ag) -
getRequestContext
-
setProperties
-
getProperties
-
setWsdlLocation
-
getWsdlLocation
-
setServiceName
-
setEndpointName
-
setServiceQName
-
getServiceQName
-
setEndpointQName
-
getEndpointQName
-
setActAs
-
setCustomContent
-
setKeySize
public void setKeySize(int i) -
getKeySize
public int getKeySize() -
setTokenType
-
getTokenType
-
setSendKeyType
public void setSendKeyType(boolean sendKeyType) -
setKeyType
-
setOnBehalfOf
-
setUseCertificateForConfirmationKeyInfo
public void setUseCertificateForConfirmationKeyInfo(boolean useCertificate) Indicate whether to use the signer's public X509 certificate for the subject confirmation key info when creating a RequestsSecurityToken message. If the property is set to 'false', only the public key value will be provided in the request. If the property is set to 'true' the complete certificate will be sent in the request. Note: this setting is only applicable for assertions that use an asymmetric proof key -
isUseCertificateForConfirmationKeyInfo
public boolean isUseCertificateForConfirmationKeyInfo() -
setPolicyInternal
protected void setPolicyInternal(org.apache.neethi.Policy newPolicy) -
setPolicyInternal
-
setPolicyInternal
-
getClient
public org.apache.cxf.endpoint.Client getClient() throws org.apache.cxf.BusException, org.apache.cxf.endpoint.EndpointException- Throws:
org.apache.cxf.BusExceptionorg.apache.cxf.endpoint.EndpointException
-
configureViaEPR
public void configureViaEPR(org.apache.cxf.ws.addressing.EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation) -
findMEXLocation
protected String findMEXLocation(org.apache.cxf.ws.addressing.EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation) -
findMEXLocation
-
createClient
protected void createClient() throws org.apache.cxf.BusException, org.apache.cxf.endpoint.EndpointException- Throws:
org.apache.cxf.BusExceptionorg.apache.cxf.endpoint.EndpointException
-
findOperation
-
issue
protected AbstractSTSClient.STSResponse issue(String appliesTo, String action, String requestType, String binaryExchange) throws Exception Make an "Issue" invocation and return the response as a STSResponse Object- Throws:
Exception
-
getOnBehalfOfToken
Get the "OnBehalfOf" element to be sent to the STS.- Throws:
Exception
-
getActAsToken
Get the "ActAs" element to be sent to the STS.- Throws:
Exception
-
getCustomContent
Get some custom Element to be inserted into the RequestSecurityToken- Throws:
Exception
-
getDelegationSecurityToken
- Throws:
Exception
-
writeElementsForRSTSymmetricKey
protected byte[] writeElementsForRSTSymmetricKey(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, boolean wroteKeySize) throws Exception - Throws:
Exception
-
writeElementsForRSTPublicKey
protected void writeElementsForRSTPublicKey(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, X509Certificate cert) throws Exception - Throws:
Exception
-
addBinaryExchange
protected void addBinaryExchange(String binaryExchange, org.apache.cxf.staxutils.W3CDOMStreamWriter writer) throws XMLStreamException - Throws:
XMLStreamException
-
addKeySize
protected void addKeySize(int keysize, org.apache.cxf.staxutils.W3CDOMStreamWriter writer) throws XMLStreamException - Throws:
XMLStreamException
-
addRequestType
protected void addRequestType(String requestType, org.apache.cxf.staxutils.W3CDOMStreamWriter writer) throws XMLStreamException - Throws:
XMLStreamException
-
getDocumentElement
-
renew
Make an "Renew" invocation and return the response as a STSResponse Object- Throws:
Exception
-
getAddressingAssertion
protected org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion getAddressingAssertion() -
validate
protected AbstractSTSClient.STSResponse validate(SecurityToken tok, String tokentype) throws Exception Make an "Validate" invocation and return the response as a STSResponse Object- Throws:
Exception
-
cancel
Make an "Cancel" invocation and return the response as a STSResponse Object- Throws:
Exception
-
useSecondaryParameters
protected boolean useSecondaryParameters() -
writeKeyType
protected String writeKeyType(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, String keyTypeToWrite) throws XMLStreamException - Throws:
XMLStreamException
-
getCert
- Throws:
Exception
-
addLifetime
- Throws:
XMLStreamException
-
addAppliesTo
- Throws:
XMLStreamException
-
addTokenType
- Throws:
XMLStreamException
-
addClaims
- Throws:
Exception
-
createSecurityToken
protected SecurityToken createSecurityToken(Element el, byte[] requestorEntropy) throws org.apache.wss4j.common.ext.WSSecurityException, org.apache.xml.security.exceptions.Base64DecodingException - Throws:
org.apache.wss4j.common.ext.WSSecurityExceptionorg.apache.xml.security.exceptions.Base64DecodingException
-
decryptKey
protected byte[] decryptKey(Element child) throws TrustException, org.apache.wss4j.common.ext.WSSecurityException, org.apache.xml.security.exceptions.Base64DecodingException - Throws:
TrustExceptionorg.apache.wss4j.common.ext.WSSecurityExceptionorg.apache.xml.security.exceptions.Base64DecodingException
-
createHandler
-
getProperty
-
createCrypto
protected org.apache.wss4j.common.crypto.Crypto createCrypto(boolean decrypt) throws IOException, org.apache.wss4j.common.ext.WSSecurityException - Throws:
IOExceptionorg.apache.wss4j.common.ext.WSSecurityException
-
findID
-
getIDFromSTR
-
setTemplate
-
setClaims
Set a Claims Object to be included in the request. This Object can be either a DOM Element, which will be copied "as is" into the request, or else a org.apache.cxf.rt.security.claims.ClaimCollection Object. -
getOutFaultInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutFaultInterceptors()- Specified by:
getOutFaultInterceptorsin interfaceorg.apache.cxf.interceptor.InterceptorProvider
-
getInFaultInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInFaultInterceptors()- Specified by:
getInFaultInterceptorsin interfaceorg.apache.cxf.interceptor.InterceptorProvider
-
getInInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInInterceptors()- Specified by:
getInInterceptorsin interfaceorg.apache.cxf.interceptor.InterceptorProvider
-
getOutInterceptors
public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutInterceptors()- Specified by:
getOutInterceptorsin interfaceorg.apache.cxf.interceptor.InterceptorProvider
-
setInInterceptors
public void setInInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) -
setInFaultInterceptors
public void setInFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) -
setOutInterceptors
public void setOutInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) -
setOutFaultInterceptors
public void setOutFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors) -
setFeatures
-
getFeatures
-
getClaimsCallbackHandler
-
setClaimsCallbackHandler
-
getWspNamespace
-
setWspNamespace
-
getUseKeyCertificate
-
setUseKeyCertificate
-
setNamespace
-