org.apache.cxf.ws.security.trust
Class STSClient

java.lang.Object
  extended by org.apache.cxf.ws.security.trust.STSClient
All Implemented Interfaces:
org.apache.cxf.configuration.Configurable, org.apache.cxf.interceptor.InterceptorProvider

public class STSClient
extends Object
implements org.apache.cxf.configuration.Configurable, org.apache.cxf.interceptor.InterceptorProvider


Field Summary
protected  Object actAs
           
protected  String addressingNamespace
           
protected  AlgorithmSuite algorithmSuite
           
protected  org.apache.cxf.Bus bus
           
protected  Element claims
           
protected  org.apache.cxf.endpoint.Client client
           
protected  String context
           
protected  Map<String,Object> ctx
           
protected  boolean enableAppliesTo
           
protected  boolean enableLifetime
           
protected  QName endpointName
           
protected  List<org.apache.cxf.feature.AbstractFeature> features
           
protected  List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> in
           
protected  List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> inFault
           
protected  boolean isSecureConv
           
protected  boolean isSpnego
           
protected  int keySize
           
protected  String keyType
           
protected  String location
           
protected  org.apache.cxf.message.Message message
           
protected  String name
           
protected  String namespace
           
protected  Object onBehalfOf
           
protected  List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> out
           
protected  List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> outFault
           
protected  org.apache.neethi.Policy policy
           
protected  boolean requiresEntropy
           
protected  boolean sendKeyType
           
protected  QName serviceName
           
protected  String soapVersion
           
protected  Element template
           
protected  String tokenType
           
protected  int ttl
           
protected  boolean useCertificateForConfirmationKeyInfo
           
protected  String wsdlLocation
           
 
Constructor Summary
STSClient(org.apache.cxf.Bus b)
           
 
Method Summary
protected  void addAppliesTo(javax.xml.stream.XMLStreamWriter writer, String appliesTo)
           
protected  void addBinaryExchange(String binaryExchange, org.apache.cxf.staxutils.W3CDOMStreamWriter writer)
           
protected  void addClaims(javax.xml.stream.XMLStreamWriter writer)
           
protected  void addKeySize(int keysize, org.apache.cxf.staxutils.W3CDOMStreamWriter writer)
           
protected  void addLifetime(javax.xml.stream.XMLStreamWriter writer)
           
protected  void addRequestType(String requestType, org.apache.cxf.staxutils.W3CDOMStreamWriter writer)
           
protected  void addTokenType(javax.xml.stream.XMLStreamWriter writer)
           
 boolean cancelSecurityToken(SecurityToken token)
           
 void configureViaEPR(org.apache.cxf.ws.addressing.EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation)
           
protected  void createClient()
           
protected  org.apache.ws.security.components.crypto.Crypto createCrypto(boolean decrypt)
           
protected  CallbackHandler createHandler()
           
protected  SecurityToken createSecurityToken(Element el, byte[] requestorEntropy)
           
protected  byte[] decryptKey(Element child)
           
protected  String findID(Element rar, Element rur, Element rst)
           
protected  String findMEXLocation(Element ref)
           
protected  String findMEXLocation(org.apache.cxf.ws.addressing.EndpointReferenceType ref, boolean useEPRWSAAddrAsMEXLocation)
           
protected  org.apache.cxf.service.model.BindingOperationInfo findOperation(String suffix)
           
 Element getActAsToken()
          Get the "ActAs" element to be sent to the STS.
protected  org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion getAddressingAssertion()
           
 String getBeanName()
           
protected  X509Certificate getCert(org.apache.ws.security.components.crypto.Crypto crypto)
           
 org.apache.cxf.endpoint.Client getClient()
           
 String getContext()
           
protected  Element getDelegationSecurityToken(Object delegationObject)
           
protected  Element getDocumentElement(DOMSource ds)
           
 QName getEndpointQName()
           
 List<org.apache.cxf.feature.AbstractFeature> getFeatures()
           
protected  String getIDFromSTR(Element el)
           
 List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInFaultInterceptors()
           
 List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInInterceptors()
           
 int getKeySize()
           
 Element getOnBehalfOfToken()
          Get the "OnBehalfOf" element to be sent to the STS.
 List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutFaultInterceptors()
           
 List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutInterceptors()
           
 Map<String,Object> getProperties()
           
protected  Object getProperty(String s)
           
 Map<String,Object> getRequestContext()
           
 QName getServiceQName()
           
 String getTokenType()
           
 String getWsdlLocation()
           
 boolean isEnableAppliesTo()
           
 boolean isRequiresEntropy()
           
 boolean isSecureConv()
           
 boolean isSpnego()
           
 boolean isUseCertificateForConfirmationKeyInfo()
           
 void renewSecurityToken(SecurityToken tok)
           
 SecurityToken requestSecurityToken()
           
 SecurityToken requestSecurityToken(String appliesTo)
           
 SecurityToken requestSecurityToken(String appliesTo, String binaryExchange)
           
 SecurityToken requestSecurityToken(String appliesTo, String action, String requestType, SecurityToken target)
           
 SecurityToken requestSecurityToken(String appliesTo, String action, String requestType, SecurityToken target, String binaryExchange)
           
 void setActAs(Object actAs)
           
 void setAddressingNamespace(String ad)
           
 void setAlgorithmSuite(AlgorithmSuite ag)
           
 void setBeanName(String s)
           
 void setClaims(Element rstClaims)
           
 void setContext(String context)
           
 void setEnableAppliesTo(boolean enableAppliesTo)
           
 void setEnableLifetime(boolean enableLifetime)
           
 void setEndpointName(String qn)
           
 void setEndpointQName(QName qn)
           
 void setFeatures(List<org.apache.cxf.feature.AbstractFeature> f)
           
 void setInFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
           
 void setInInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
           
 void setKeySize(int i)
           
 void setKeyType(String keyType)
           
 void setLocation(String location)
           
 void setMessage(org.apache.cxf.message.Message message)
           
 void setOnBehalfOf(Object onBehalfOf)
           
 void setOnBehalfOfElement(Element onBehalfOfElement)
          Deprecated. 
 void setOutFaultInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
           
 void setOutInterceptors(List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> interceptors)
           
 void setPolicy(Object newPolicy)
          Sets the WS-P policy that is applied to communications between this client and the remote server if no value is supplied for setWsdlLocation(String).
protected  void setPolicyInternal(Element newPolicy)
           
protected  void setPolicyInternal(org.apache.neethi.Policy newPolicy)
           
 void setProperties(Map<String,Object> p)
           
 void setRequiresEntropy(boolean requiresEntropy)
           
 void setSecureConv(boolean secureConv)
           
 void setSendKeyType(boolean sendKeyType)
           
 void setServiceName(String qn)
           
 void setServiceQName(QName qn)
           
 void setSoap11()
           
 void setSoap11(boolean b)
           
 void setSoap12()
           
 void setSpnego(boolean spnego)
           
 void setTemplate(Element rstTemplate)
           
 void setTokenType(String tokenType)
           
 void setTrust(Trust10 trust)
           
 void setTrust(Trust13 trust)
           
 void setTtl(int ttl)
           
 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.
 void setWsdlLocation(String wsdl)
           
protected  boolean useSecondaryParameters()
           
 List<SecurityToken> validateSecurityToken(SecurityToken tok)
           
protected  List<SecurityToken> validateSecurityToken(SecurityToken tok, String tokentype)
           
protected  void writeElementsForRSTPublicKey(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, X509Certificate cert)
           
protected  byte[] writeElementsForRSTSymmetricKey(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, boolean wroteKeySize)
           
protected  String writeKeyType(org.apache.cxf.staxutils.W3CDOMStreamWriter writer, String keyTypeToWrite)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bus

protected org.apache.cxf.Bus bus

name

protected String name

client

protected org.apache.cxf.endpoint.Client client

location

protected String location

wsdlLocation

protected String wsdlLocation

serviceName

protected QName serviceName

endpointName

protected QName endpointName

policy

protected org.apache.neethi.Policy policy

soapVersion

protected String soapVersion

keySize

protected int keySize

requiresEntropy

protected boolean requiresEntropy

template

protected Element template

claims

protected Element claims

algorithmSuite

protected AlgorithmSuite algorithmSuite

namespace

protected String namespace

addressingNamespace

protected String addressingNamespace

onBehalfOf

protected Object 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

actAs

protected Object actAs

tokenType

protected String tokenType

keyType

protected String keyType

sendKeyType

protected boolean sendKeyType

message

protected org.apache.cxf.message.Message message

context

protected String context

ctx

protected Map<String,Object> ctx

in

protected List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> 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

protected List<org.apache.cxf.feature.AbstractFeature> features
Constructor Detail

STSClient

public STSClient(org.apache.cxf.Bus b)
Method Detail

getBeanName

public String getBeanName()
Specified by:
getBeanName in interface org.apache.cxf.configuration.Configurable

setBeanName

public void setBeanName(String s)

setLocation

public void setLocation(String location)

setMessage

public void setMessage(org.apache.cxf.message.Message message)

setTtl

public void setTtl(int ttl)

setEnableLifetime

public void setEnableLifetime(boolean enableLifetime)

setPolicy

public void setPolicy(Object newPolicy)
Sets the WS-P policy that is applied to communications between this client and the remote server if no value is supplied for setWsdlLocation(String).

Accepts Policy or Element as input.

Parameters:
newPolicy - the policy object
Throws:
IllegalArgumentException - if newPolicy is not one of the supported types.

setSoap12

public void setSoap12()

setSoap11

public void setSoap11()

setSoap11

public void setSoap11(boolean b)

setAddressingNamespace

public void setAddressingNamespace(String ad)

setTrust

public void setTrust(Trust10 trust)

setTrust

public void setTrust(Trust13 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)

isEnableAppliesTo

public boolean isEnableAppliesTo()

setEnableAppliesTo

public void setEnableAppliesTo(boolean enableAppliesTo)

getContext

public String getContext()

setContext

public void setContext(String context)

setAlgorithmSuite

public void setAlgorithmSuite(AlgorithmSuite ag)

getRequestContext

public Map<String,Object> getRequestContext()

setProperties

public void setProperties(Map<String,Object> p)

getProperties

public Map<String,Object> getProperties()

setWsdlLocation

public void setWsdlLocation(String wsdl)

getWsdlLocation

public String getWsdlLocation()

setServiceName

public void setServiceName(String qn)

setEndpointName

public void setEndpointName(String qn)

setServiceQName

public void setServiceQName(QName qn)

getServiceQName

public QName getServiceQName()

setEndpointQName

public void setEndpointQName(QName qn)

getEndpointQName

public QName getEndpointQName()

setActAs

public void setActAs(Object actAs)

setKeySize

public void setKeySize(int i)

getKeySize

public int getKeySize()

setTokenType

public void setTokenType(String tokenType)

getTokenType

public String getTokenType()

setSendKeyType

public void setSendKeyType(boolean sendKeyType)

setKeyType

public void setKeyType(String keyType)

setOnBehalfOfElement

@Deprecated
public void setOnBehalfOfElement(Element onBehalfOfElement)
Deprecated. 


setOnBehalfOf

public void setOnBehalfOf(Object onBehalfOf)

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

protected void setPolicyInternal(Element newPolicy)

getClient

public org.apache.cxf.endpoint.Client getClient()
                                         throws org.apache.cxf.BusException,
                                                org.apache.cxf.endpoint.EndpointException
Throws:
org.apache.cxf.BusException
org.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

protected String findMEXLocation(Element ref)

createClient

protected void createClient()
                     throws org.apache.cxf.BusException,
                            org.apache.cxf.endpoint.EndpointException
Throws:
org.apache.cxf.BusException
org.apache.cxf.endpoint.EndpointException

findOperation

protected org.apache.cxf.service.model.BindingOperationInfo findOperation(String suffix)

requestSecurityToken

public SecurityToken requestSecurityToken()
                                   throws Exception
Throws:
Exception

requestSecurityToken

public SecurityToken requestSecurityToken(String appliesTo)
                                   throws Exception
Throws:
Exception

requestSecurityToken

public SecurityToken requestSecurityToken(String appliesTo,
                                          String binaryExchange)
                                   throws Exception
Throws:
Exception

requestSecurityToken

public SecurityToken requestSecurityToken(String appliesTo,
                                          String action,
                                          String requestType,
                                          SecurityToken target)
                                   throws Exception
Throws:
Exception

requestSecurityToken

public SecurityToken requestSecurityToken(String appliesTo,
                                          String action,
                                          String requestType,
                                          SecurityToken target,
                                          String binaryExchange)
                                   throws Exception
Throws:
Exception

getOnBehalfOfToken

public Element getOnBehalfOfToken()
                           throws Exception
Get the "OnBehalfOf" element to be sent to the STS.

Throws:
Exception

getActAsToken

public Element getActAsToken()
                      throws Exception
Get the "ActAs" element to be sent to the STS.

Throws:
Exception

getDelegationSecurityToken

protected Element getDelegationSecurityToken(Object delegationObject)
                                      throws Exception
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 javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addKeySize

protected void addKeySize(int keysize,
                          org.apache.cxf.staxutils.W3CDOMStreamWriter writer)
                   throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addRequestType

protected void addRequestType(String requestType,
                              org.apache.cxf.staxutils.W3CDOMStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getDocumentElement

protected Element getDocumentElement(DOMSource ds)

renewSecurityToken

public void renewSecurityToken(SecurityToken tok)
                        throws Exception
Throws:
Exception

getAddressingAssertion

protected org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion getAddressingAssertion()

validateSecurityToken

public List<SecurityToken> validateSecurityToken(SecurityToken tok)
                                          throws Exception
Throws:
Exception

validateSecurityToken

protected List<SecurityToken> validateSecurityToken(SecurityToken tok,
                                                    String tokentype)
                                             throws Exception
Throws:
Exception

cancelSecurityToken

public boolean cancelSecurityToken(SecurityToken token)
                            throws Exception
Throws:
Exception

useSecondaryParameters

protected boolean useSecondaryParameters()

writeKeyType

protected String writeKeyType(org.apache.cxf.staxutils.W3CDOMStreamWriter writer,
                              String keyTypeToWrite)
                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getCert

protected X509Certificate getCert(org.apache.ws.security.components.crypto.Crypto crypto)
                           throws Exception
Throws:
Exception

addLifetime

protected void addLifetime(javax.xml.stream.XMLStreamWriter writer)
                    throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addAppliesTo

protected void addAppliesTo(javax.xml.stream.XMLStreamWriter writer,
                            String appliesTo)
                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addTokenType

protected void addTokenType(javax.xml.stream.XMLStreamWriter writer)
                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addClaims

protected void addClaims(javax.xml.stream.XMLStreamWriter writer)
                  throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createSecurityToken

protected SecurityToken createSecurityToken(Element el,
                                            byte[] requestorEntropy)
                                     throws org.apache.ws.security.WSSecurityException
Throws:
org.apache.ws.security.WSSecurityException

decryptKey

protected byte[] decryptKey(Element child)
                     throws TrustException,
                            org.apache.ws.security.WSSecurityException
Throws:
TrustException
org.apache.ws.security.WSSecurityException

createHandler

protected CallbackHandler createHandler()

getProperty

protected Object getProperty(String s)

createCrypto

protected org.apache.ws.security.components.crypto.Crypto createCrypto(boolean decrypt)
                                                                throws IOException,
                                                                       org.apache.ws.security.WSSecurityException
Throws:
IOException
org.apache.ws.security.WSSecurityException

findID

protected String findID(Element rar,
                        Element rur,
                        Element rst)

getIDFromSTR

protected String getIDFromSTR(Element el)

setTemplate

public void setTemplate(Element rstTemplate)

setClaims

public void setClaims(Element rstClaims)

getOutFaultInterceptors

public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutFaultInterceptors()
Specified by:
getOutFaultInterceptors in interface org.apache.cxf.interceptor.InterceptorProvider

getInFaultInterceptors

public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInFaultInterceptors()
Specified by:
getInFaultInterceptors in interface org.apache.cxf.interceptor.InterceptorProvider

getInInterceptors

public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getInInterceptors()
Specified by:
getInInterceptors in interface org.apache.cxf.interceptor.InterceptorProvider

getOutInterceptors

public List<org.apache.cxf.interceptor.Interceptor<? extends org.apache.cxf.message.Message>> getOutInterceptors()
Specified by:
getOutInterceptors in interface org.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

public void setFeatures(List<org.apache.cxf.feature.AbstractFeature> f)

getFeatures

public List<org.apache.cxf.feature.AbstractFeature> getFeatures()


Apache CXF