Steps to install
Now we'll look at how to run the first sample inside samples/policy folder.
$ant service.01
$ant client.01
Congratulations! Now you have executed the first sample. Rest of the samples can be run by changing the sample number.
When securing a SOAP message, the sender must know the security actions to be performed on the message and the receiver must know enough details to process and validate the security of the message. Therefore when using Rampart with Axis2, it must be engaged at both ends.
Observe how module has been engaged in server side by opening samples/policy/sample01/services.xml. The following line has engaged the module.
Engaging Rampart at client side is done programatically as follows.
WS-Security Policy can be used to indicate what security actions that needs be performed on SOAP messages and and what actions should be validated. The file 'samples/policy/sample01/policy.xml' configures Rampart to add Username Token with Timestamp to this message. The element <RampartConfig> in policy.xml defines Rampart specific configurations.
Policy at serverside is included in samples/policy/sample01/services.xml file. This configures Rampart module at serverside to validate the message for Username Token an Timestamp.
More details on RampartConfig can be found here.
It is interesting to view the secured SOAP message on the wire using TCP monitor. Change the "client.port" property in samples/policy/build.xml file to the listening port of TCP monitor. This will send all the messages through TCP monitor when you execute the ant script. Observe the
Security Token Service can be set up as per WS-Trust specification using Rampart. The default security token service shipped with the rampart distribution is contained in the rampart-trust.mar module. It can issue SCT tokens and SAML tokens. Sample05 contains a client that connects to the default STS and obtain a SAML token. The services.xml in the sample contains "saml-issuer-config" parameter that is used to configure the default SAML issuer.
STS with a custom issuerFirst the default rampart.mar has to be removed from the modules. Then write you own issuer implementing the "org.apache.rahas.TokenIssuer"
interface. Let's say that your issuer is "org.custom.MyIssuer"
. Then create a Axis2 service archive with the following in the services.xml. Drop the archive into the repository and you have a STS with a CustomToken issuer.