public final class WsitClientTask
extends org.apache.tools.ant.Task
Creates WSIT client configuration files from a WSDL and policy information.
The task takes the WSDL file specified strips any existing policy information from it and merges in the policy information provided. The task can take a policy file and merge it in or it can create a policy for specifying callback handlers automatically.
If you specify a policy, the policy will be used. You must also specify a bindingpolicy to use. The bindingpolicy must be a policy id that exists in the policy document provided.
If you only need to specify callback handlers, the task can automatically construct a policy for you. Simply provide any of the callback handler properties (samlhandler, passwordhandler, usernamehandler) and a policy will be automatically created and merged into the WSIT configuration file.
The task will output two files, the first is the client configuration for the service that the WSDL defines. The second is the main WSIT client configuration file called wsit-client.xml. If a wsit-client.xml file already exists in the output folder, the file will be updated.
To use this task, include a taskdef for the appsecinc-anttasks in your build.xml
<taskdef resource="com/appsecinc/ant/appsecinc-anttasks.properties" classpath="appsecinc-anttasks.jar" />
You can then use the task
<wsit-client
outputdir="src/META-INF"
wsdl="src/wsdl/MyService.wsdl">
<callback
usernameHandler="com.appsec.UsernameHandler"
passwordHandler="com.appsec.PasswordHandler" />
<keystore
aliasSelector="com.appsec.AliasSelector"
callbackHandler="com.appsec.KeystoreHandler" />
<truststore ..../>
<certstore ..../>
</wsit-client>
This code will produce two files in src/META-INF: MyService.xml
and wsit-client.xml. This configuration tells any MyService clients to
use the specified Username Handler and Password Handler.
The inner tags (callback, keystore, truststore, and certstore) each allow you to specify security configuration to support different security scenarios. Not all of the tags are required for every security scenario. For a good list of security scenarios, please see http://xwss.java.net/articles/security_config.html
| Constructor and Description |
|---|
WsitClientTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguredCallback(CallbackConfig cb) |
void |
addConfiguredCertstore(CertStoreConfig cs) |
void |
addConfiguredKeystore(KeyStoreConfig ks) |
void |
addConfiguredSecureConversation(SecureConversation sc) |
void |
addConfiguredTruststore(TrustStoreConfig ts) |
void |
configureCertStore(Document wsitDoc,
Element parent) |
void |
execute() |
void |
setBindingpolicy(String bindingpolicy)
Required if a policy is set - Specifies the id of the
desired policy.
|
void |
setOutputdir(File output)
Required - The configuration files will be written to this directory.
|
void |
setOutputfile(String output)
Optional - overrides the output file name.
|
void |
setPolicy(File policy)
Optional - A document containing a Policy definition to be
used in the client configuration.
|
void |
setWsdl(File wsdl)
Required - The WSDL to create client configuration for.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic void execute()
execute in class org.apache.tools.ant.Taskpublic void setWsdl(File wsdl)
wsdl - public void setPolicy(File policy)
policy - public void setOutputdir(File output)
output - public void setBindingpolicy(String bindingpolicy)
Required if a policy is set - Specifies the id of the desired policy.
If the is specified and policy is not set, this will be used as the id of the automatically generated policy.
bindingpolicy - public void setOutputfile(String output)
output - public void addConfiguredCallback(CallbackConfig cb)
public void addConfiguredKeystore(KeyStoreConfig ks)
public void addConfiguredTruststore(TrustStoreConfig ts)
public void addConfiguredCertstore(CertStoreConfig cs)
public void addConfiguredSecureConversation(SecureConversation sc)
Copyright © 2011-2012 Application Security, Inc. All Rights Reserved.