<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>thilina&#039;s blog</title>
	<atom:link href="http://thilinamb.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thilinamb.wordpress.com</link>
	<description>Security, SOA, random thoughts...</description>
	<lastBuildDate>Wed, 09 Dec 2009 11:50:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='thilinamb.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/6eb49db35c657148b7d00b6e97ff2d33?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>thilina&#039;s blog</title>
		<link>http://thilinamb.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://thilinamb.wordpress.com/osd.xml" title="thilina&#039;s blog" />
	<atom:link rel='hub' href='http://thilinamb.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WSO2 Identity Server 2.0.2 Released</title>
		<link>http://thilinamb.wordpress.com/2009/11/19/wso2-identity-server-2-0-2-released/</link>
		<comments>http://thilinamb.wordpress.com/2009/11/19/wso2-identity-server-2-0-2-released/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:09:29 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=383</guid>
		<description><![CDATA[The WSO2 Identity Server team is pleased to announce the release of version 2.0.2 of the Open Source WSO2 Identity Server (IS). IS 2.0.2 release is available for download at [1]. This is based on revolutionary the WSO2 Carbon [2] framework, Middleware a la carte&#8217;. All the major features have been developed as pluggable Carbon [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=383&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The WSO2 Identity Server team is pleased to announce the release of<br />
version 2.0.2 of the Open Source WSO2 Identity Server (IS).</p>
<p>IS 2.0.2 release is available for download at [1].</p>
<p>This is based on revolutionary the WSO2 Carbon [2] framework, Middleware<br />
a la carte&#8217;.</p>
<p>All the major features have been developed as pluggable Carbon components.</p>
<p><strong>New Features</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>1. Various bug fixes and enhancements including architectural improvements to Apache Axis2, Apache Rampart, Apache Sandesha2 , WSO2 Carbon and other projects.<br />
2. Equinox P2 based provisioning support &#8211;  extend your IS instance by installing new P2 features [5].</p>
<p><strong>Other Key Features</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Entitlement Engine with XACML 2.0 support.<br />
2. Claim based Security Token Service.<br />
3. Extension points for SAML assertion handling.<br />
4. OpenID Provider<br />
5. Information Card Provider<br />
6. SAML 2.0 Token Profile support<br />
7. Passive STS</p>
<p><strong>How to Run</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Extract the downloaded zip.<br />
2. Go to the bin directory in the extracted folder.<br />
3. Run the wso2server.sh or wso2server.bat as appropriate.<br />
4. Point your browser to the URL <a href="https://localhost:9443/carbon" target="_blank">https://localhost:9443/carbon</a><br />
5. Use &#8220;admin&#8221;, &#8220;admin&#8221; as the user name and password.<br />
6. If you need to start the OSGi console with the server use the<br />
property -DosgiConsole when starting the server<br />
<strong><br />
Known issues</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
All the known issues have been filed here [3]. Please report any other<br />
issues you find as JIRA entries.<br />
<strong><br />
Contact us</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WSO2 Identity Server developers can be contacted via the mailing lists:<br />
For Users: <a href="mailto:carbon-user@wso2.org" target="_blank">carbon-user@wso2.org</a><br />
For Developers: <a href="mailto:carbon-dev@wso2.org" target="_blank">carbon-dev@wso2.org</a></p>
<p>Alternatively, questions can also be raised in the Identity Server forum<br />
at <a href="http://wso2.org/forum/308" target="_blank">http://wso2.org/forum/308</a><br />
<strong><br />
Training</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;<br />
WSO2 Inc. offers a variety of professional Training Programs, including<br />
training on general Web services as well as WSO2 Identity Server,<br />
Apache Axis2, Data Services and a number of other products. For<br />
additional support information please refer to<br />
<a href="http://wso2.com/training/course-catalog/" target="_blank">http://wso2.com/training/course-catalog/</a><br />
<strong></strong></p>
<p><strong>Support</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WSO2 Inc. offers a variety of development and production support<br />
programs, ranging from Web-based support up through normal business<br />
hours, to premium 24&#215;7 phone support. For additional support information<br />
please refer to <a href="http://wso2.com/support/" target="_blank">http://wso2.com/support/</a></p>
<p>For more information on WSO2 Identity Server, visit the WSO2 Oxygen Tank[4].</p>
<p>Thank you for your interest in WSO2 Identity Server.</p>
<p>-The WSO2 Identity Server team</p>
<p>[1]: <a href="http://wso2.org/downloads/identity" target="_blank">http://wso2.org/downloads/identity</a><br />
[2]: <a href="http://wso2.org/projects/carbon" target="_blank">http://wso2.org/projects/carbon</a><br />
[3]: <a href="https://wso2.org/jira/browse/CARBON" target="_blank">https://wso2.org/jira/browse/CARBON</a><br />
[4]: <a href="http://wso2.org/" target="_blank">http://wso2.org</a><br />
[5]: <a href="https://wso2.org/wiki/display/carbon/p2-based-provisioning-support" target="_blank">https://wso2.org/wiki/display/carbon/p2-based-provisioning-support</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/383/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/383/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=383&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/11/19/wso2-identity-server-2-0-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Axis2 Dynamic Client to invoke Secured Web Services</title>
		<link>http://thilinamb.wordpress.com/2009/11/16/using-axis2-dynamic-client-to-invoke-secured-web-services/</link>
		<comments>http://thilinamb.wordpress.com/2009/11/16/using-axis2-dynamic-client-to-invoke-secured-web-services/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 19:03:17 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[axis2]]></category>
		<category><![CDATA[rampart]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=359</guid>
		<description><![CDATA[This post has been moved to : http://blog.thilinamb.com/2009/11/using-axis2-dynamic-client-to-invoke.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=359&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post has been moved to : <a href="http://blog.thilinamb.com/2009/11/using-axis2-dynamic-client-to-invoke.html">http://blog.thilinamb.com/2009/11/using-axis2-dynamic-client-to-invoke.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/359/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=359&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/11/16/using-axis2-dynamic-client-to-invoke-secured-web-services/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use SAML 2.0 Token Profile Support in Rampart 1.5</title>
		<link>http://thilinamb.wordpress.com/2009/10/20/saml-2-0-token-profile-support-in-rampart-1-5/</link>
		<comments>http://thilinamb.wordpress.com/2009/10/20/saml-2-0-token-profile-support-in-rampart-1-5/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 17:05:04 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=319</guid>
		<description><![CDATA[From 1.5 release onwards Apache Rampart supports SAML 2.0 Token Profile. With this new feature, it allows web service consumers to obtain SAML 2.0 tokens from Security Token Services(STS) and use those tokens to consume other services which impose the presence of a SAML 2.0 token in a SOAP request. In this post, I am [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=319&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>From 1.5 release onwards <a href="http://ws.apache.org/rampart/">Apache Rampart</a> supports <a href="http://www.oasis-open.org/committees/download.php/16768/wss-v1.1-spec-os-SAMLTokenProfile.pdf" target="_blank">SAML 2.0 Token Profile</a>. With this new feature, it allows web service consumers to obtain SAML 2.0 tokens from Security Token Services(STS) and use those tokens to consume other services which impose the presence of a SAML 2.0 token in a SOAP request. In this post, I am explaining how to use a SAML 2.0 token using <a href="http://ws.apache.org/rampart/">Apache Rampart</a> in a WS Trust scenario.</p>
<p>1. As the first step you need to set up Apache Axis2 + Rampart. You can download Axis2 1.5 from <a href="http://ws.apache.org/axis2/download/1_5/download.cgi" target="_blank">here</a> and Rampart 1.5 from <a href="http://builder.wso2.org/~carbon/thilina/saml2-resources/rampart-dist-1.5-bin.zip" target="_blank">here</a>.(Since Rampart 1.5 is not released yet, I have hosted the binaries built from the 1.5 branch) I am using an Axis2 deployment on <a href="http://tomcat.apache.org/">Apache Tomcat</a> to host services in this post.</p>
<ul>
<li>You can simply download <a href="http://apache.mirrors.tds.net/ws/axis2/1_5/axis2-1.5-war.zip">Axis2 webapp </a>and deploy it in Apache Tomcat. (I am referring the tomcat installation directory as TOMCAT_HOME from here onwards)</li>
<li style="text-align:justify;">Copy the set of jars inside the lib directory of Rampart binary distribution into <em>$TOMCAT_HOME/webapps/axis2/WEB-INF/lib</em> and copy the rampart and rahas module archives(.mar) files into <em>$TOMCAT_HOME/webapps/axis2/WEB-INF/modules</em> directory. Rampart makes use of WSS4J for SAML token validation. Because WSS4J release with the SAML 2.0 token validation support is yet to be released, I am using a custom WSS4J implementation in this scenario. Please download wss4j-1.5.7.wso2v2.jar from <a href="http://builder.wso2.org/~carbon/thilina/saml2-resources/wss4j-1.5.7.wso2v2.jar" target="_blank">here</a> and replace the wss4j-1.5.8.jar which is shipped with Rampart.</li>
<li style="text-align:justify;">To use SAML 2.0 support, it is required to endorse the default JAXP implementation of the JDK with Apache Xerces and Xalan. You can find more information on how to endorse the JDK in the README file of Rampart binary distribution. Since Tomcat uses its own endorsed directory, it is required to endorse the Tomcat deployment. You can copy the same set of jar files which is used to endorse the JDK to <em>$TOMCAT_HOME</em>/<em>endorsed</em> directory. For convenience, I have hosted the necessary endorsing jars <a href="http://builder.wso2.org/~carbon/thilina/endorsed.zip">here</a>. You can download this set of jars and copy them to<em> $JAVA_HOME/jre/lib/endorsed</em> directory.</li>
</ul>
<p>2. As the second step you need to set up the STS and the relying party service. I am using the SAML 1.1 sample shipped with Apache Rampart with some modifications to make it use SAML 2.0. We are using a service archive which contains both relying party service and configurations for STS. STS is implemented inside Rampart and it is sufficient to provide only the configuration. You can download the this service archive named &#8220;samlple05.aar&#8221; from <a href="http://builder.wso2.org/~carbon/thilina/saml2-resources/sample05.aar">here</a>. This service archive will contain a service group where STS and Sample05 are the members of that service group.</p>
<ul>
<li>It is possible to configure STS according to the user requirements. STS configuration of this sample can be found in services.xml file inside the META-INF directory of the extracted service archive. These configurations are available in the <em>&lt;parameter name=&#8221;saml-issuer-config&#8221;&gt;</em> element. Lets go through some of the important parameters of this configuration.
<ul>
<li><em>issuerName</em> &#8211; This is used to identify the issuer, this could be the end point of the issuer or any other identifier used by the relying party services.</li>
<li><em>issuerKeyAlias</em> &#8211; This is the alias of the certificate that STS will be using for signing SAML Assertions.</li>
<li><em>issuerKeyPassword</em> &#8211; Private key password of the certificate of the STS</li>
<li><em>cryptoProperties</em> &#8211; The child elements of this configuration element is used to identify the keystore which is used by the STS. Location of the keystore, keystore type and keystore password are specifed as child elements of this parameter.</li>
<li><em>timeToLive</em> &#8211; Validity period of a SAML assertion(mentioned in seconds)</li>
<li><em>trusted-services</em> &#8211; Under this parameter, you can specify the EPRs of the trusted relying party services for which users are obtaining SAML tokens. It is possible to specify a wildcard character, so that STS trusts any relying party service. In this sample, we have used a wildcard character. But in real world scenarios, it is recommended not to use this and mention the trusted services specifically.</li>
</ul>
</li>
<li>STS is a web service, hence it is possible to publish its requirement as a policy. Please note that, it is better if STS can express its authentication requirements for the user in its policy. In this case, we are using a security policy which contains a Asymmetric Binding. So the X.509 certificate of the client is used to authenticate him.</li>
<li>Then it contains the policy and configuration required for the relying party service (sample05) which has a &#8216;echo&#8217; operation. The security policy of the relying party service imposes the presence of a SAML 2.0 token in the SAML request.</li>
</ul>
<pre style="padding-left:60px;">&lt;sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                                &lt;wsp:Policy&gt;
       &lt;sp:IssuedToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt;
           &lt;Issuer xmlns="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
               &lt;Address xmlns="http://www.w3.org/2005/08/addressing"&gt;https://kirillgdev04/Security_Federation_SecurityTokenService_Indigo/Symmetric.svc/Scenario_1_IssuedTokenOverTransport_UsernameOverTransport&lt;/Address&gt;
           &lt;/Issuer&gt;
           &lt;sp:RequestSecurityTokenTemplate&gt;
              &lt;t:TokenType xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"&gt;urn:oasis:names:tc:SAML:2.0:assertion&lt;/t:TokenType&gt;
              &lt;t:KeyType xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"&gt;http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey&lt;/t:KeyType&gt;
              &lt;t:KeySize xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"&gt;256&lt;/t:KeySize&gt;
           &lt;/sp:RequestSecurityTokenTemplate&gt;
           &lt;wsp:Policy&gt;
             &lt;sp:RequireInternalReference/&gt;
           &lt;/wsp:Policy&gt;
      &lt;/sp:IssuedToken&gt;
   &lt;/wsp:Policy&gt;
 &lt;/sp:SupportingTokens&gt;</pre>
<p style="padding-left:30px;">This policy assertion establishes the requirement for a SAML 2.0 assertion which uses a symmetric key with a length of 256 bit for SAML subject confirmation. These requirements are specified in the RequestSecurityTemplate policy assertion.</p>
<ul>
<li>Then lets deploy this service archive in Axis2. You can simply copy sample05.aar file into <em><em>$TOMCAT_HOME</em>/webapps/axis2/WEB-INF/services/</em> directory and restart Tomcat if you haven&#8217;t enable hot deployment.</li>
</ul>
<p>3. Now lets look at the client code.</p>
<pre>package org.wso2.sts;                                                                            

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyEngine;
import org.apache.rahas.RahasConstants;
import org.apache.rahas.Token;
import org.apache.rahas.TokenStorage;
import org.apache.rahas.TrustException;
import org.apache.rahas.TrustUtil;
import org.apache.rahas.client.STSClient;
import org.apache.rampart.RampartMessageData;
import org.apache.ws.secpolicy.SP11Constants;
import org.apache.ws.secpolicy.SPConstants;
import org.opensaml.XML;

import javax.xml.namespace.QName;

public class Client {

 public static void main(String[] args) throws Exception {

 //TODO : replace with the local paths in your machine
 String epr = "http://localhost:8081/axis2/services/sample05";
 String repo = "/path/to/repo";
 String servicePolicy = "/path/to/service-policy.xml";
 String stsPolicy = "/path/to/sts-policy.xml";

 ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo, null);

 STSClient stsClient = new STSClient(ctx);

 stsClient.setRstTemplate(getRSTTemplate());
 stsClient.setVersion(RahasConstants.VERSION_05_12);
 String action = TrustUtil.getActionValue(RahasConstants.VERSION_05_02, RahasConstants.RST_ACTION_ISSUE);
 stsClient.setAction(action);

 //Obtain the token
 Token responseToken = stsClient.requestSecurityToken(loadPolicy(servicePolicy),
 "http://localhost:8081/axis2/services/STS", loadPolicy(stsPolicy), epr);

 System.out.println("\n------------------------------ Requested Token ---------------------------------------\n");
 System.out.println(responseToken.getToken().toString());

 TokenStorage store = TrustUtil.getTokenStore(ctx);
 store.add(responseToken);

 //Call the relying party service
 ServiceClient client = new ServiceClient(ctx, null);

 Options options = new Options();
 options.setAction("urn:echo");
 options.setTo(new EndpointReference(epr));
 options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(servicePolicy));
 options.setProperty(RampartMessageData.KEY_CUSTOM_ISSUED_TOKEN, responseToken.getId());
 client.setOptions(options);

 client.engageModule("addressing");
 client.engageModule("rampart");

 OMElement response = client.sendReceive(getPayload("Hello world1"));
 System.out.println("Response  : " + response);

 }

 private static Policy loadPolicy(String xmlPath) throws Exception {
 StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
 return PolicyEngine.getPolicy(builder.getDocumentElement());
 }

 private static OMElement getPayload(String value) {
 OMFactory factory = OMAbstractFactory.getOMFactory();
 OMNamespace ns = factory.createOMNamespace("http://sample05.policy.samples.rampart.apache.org", "ns1");
 OMElement elem = factory.createOMElement("echo", ns);
 OMElement childElem = factory.createOMElement("param0", null);
 childElem.setText(value);
 elem.addChild(childElem);

 return elem;

 }

 private static OMElement getRSTTemplate() throws Exception {
 OMFactory fac = OMAbstractFactory.getOMFactory();
 OMElement elem = fac.createOMElement(SP11Constants.REQUEST_SECURITY_TOKEN_TEMPLATE);
 TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12, elem).setText(RahasConstants.TOK_TYPE_SAML_20);
 TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_12, elem, RahasConstants.KEY_TYPE_SYMM_KEY);
 TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_12, elem, 256);

 return elem;
 }
}</pre>
<p>Above listing depicts the complete version of the Client code. In order to make this work, you need to make some changes in the paths to repos, policies etc. Modify the repo, epr, servicePolicy and stsPolicy accordingly. I am explaining some of the important code segments of the above code for the sake of completion.</p>
<ul>
<li>After instantiating the STSClient object, we set its RSTTemplate. In this code, <em>getRSTTemplate() </em>method is used to create the RSTTemplate. The SAML version, key type and the key size are set to the RST(Request Security Token) inside this method. Following code snipped sets the SAML version, Key type and key length in RST.</li>
</ul>
<pre>
<pre> TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12, elem).setText(RahasConstants.TOK_TYPE_SAML_20);
 TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_12, elem, RahasConstants.KEY_TYPE_SYMM_KEY);
 TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_12, elem, 256);</pre>
</pre>
<ul>
<li>Then we set the RST action. In this scenario, we are requesting a token from the STS. So the corresponding trust action is ISSUE.</li>
</ul>
<pre> String action = TrustUtil.getActionValue(RahasConstants.VERSION_05_02, RahasConstants.RST_ACTION_ISSUE);
 stsClient.setAction(action);</pre>
<ul>
<li>Then the RST is sent to the STS. Here, we are passing the EPR of the RP service as a parameter. This is going to be checked against the set of trusted services we specified in the sts-configuration.</li>
</ul>
<pre>Token responseToken = stsClient.requestSecurityToken(loadPolicy(servicePolicy), "http://localhost:8081/axis2/services/STS", loadPolicy(stsPolicy), epr);</pre>
<ul>
<li>After obtaining the token, we are storing it in the trust store and then sending it to the RP service.</li>
</ul>
<p>You can download the source code, policy files and client site key store from <a href="http://builder.wso2.org/~carbon/thilina/saml2-resources/client-side/">here</a>. Please note that you have to change the rampart-config parameters in both policy files to reflect your local settings.</p>
<p>In this sample, we are using a password callback handler to load the passwords of the private keys. In the client&#8217;s end, we are using the following password callback handler.</p>
<pre>package org.wso2.sts;

import org.apache.ws.security.WSPasswordCallback;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import java.io.IOException;

public class PWCBHandler  implements CallbackHandler{
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
         for (int i = 0; i &lt; callbacks.length; i++) {
             WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
             String id = pwcb.getIdentifer();
             if("client".equals(id)) {
               pwcb.setPassword("apache");
             } else if("service".equals(id)) {
               pwcb.setPassword("apache");
            }
         }
   }
}</pre>
<p>To get the client code up and running you need to add certain set of jars to your classpath. Most straight forward approach is adding the Axis2 &#8216;lib&#8217; into your classpath. It contains all the jars required to compile and run this sample.</p>
<p>Following listing depicts the RST sent from Client to STS.</p>
<pre>&lt;wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512"&gt;
    &lt;wst:RequestType&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue&lt;/wst:RequestType&gt;
    &lt;wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.o383rg/ws/2004/09/policy"&gt;
        &lt;wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt;
            &lt;wsa:Address&gt;http://localhost:8081/axis2/services/sample05&lt;/wsa:Address&gt;
        &lt;/wsa:EndpointReference&gt;
    &lt;/wsp:AppliesTo&gt;
    &lt;wst:Lifetime&gt;
        &lt;wsu:Created&gt;2009-10-20T13:15:51.739Z&lt;/wsu:Created&gt;
        &lt;wsu:Expires&gt;2009-10-20T13:20:51.739Z&lt;/wsu:Expires&gt;
    &lt;/wst:Lifetime&gt;
    &lt;wst:TokenType&gt;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0&lt;/wst:TokenType&gt;
    &lt;wst:KeyType&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey&lt;/wst:KeyType&gt;
    &lt;wst:KeySize&gt;256&lt;/wst:KeySize&gt;
    &lt;wst:Entropy&gt;
        &lt;wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"&gt;
            g5WVRpUl7bKno8LYFC9JUGLpe1NZpkZ/
        &lt;/wst:BinarySecret&gt;
    &lt;/wst:Entropy&gt;
    &lt;wst:ComputedKeyAlgorithm&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1&lt;/wst:ComputedKeyAlgorithm&gt;
&lt;/wst:RequestSecurityToken&gt;</pre>
<p>In this RST, <em>RequestType</em> is set to &#8220;http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue&#8221;. We have passed EPR of the RP service as a parameter when requesting the token. If you carefully observe  <em>AppliesTo</em> element, you will note the EPR we have passed has been set as the value of this element. Similarly the token type, key type and the key size are also appearing in the RST as we have set them in the RSTTemplate. The <em>&#8220;Entopy&#8221;</em> element is used pass a binary secret which is used to derive keys. I am not going into further details about key derivation is WS Trust. Plese refer to the <a href="http://docs.oasis-open.org/ws-sx/ws-trust/v1.4/os/ws-trust-1.4-spec-os.doc" target="_blank">WS Trust specification</a> for further details.</p>
<p>Following is the resulting RSTR(Request Security Token Response) returned by the STS.</p>
<pre>&lt;wst:RequestSecurityTokenResponseCollection xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512"&gt;
    &lt;wst:RequestSecurityTokenResponse&gt;
        &lt;wst:TokenType&gt;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0&lt;/wst:TokenType&gt;
        &lt;wst:KeySize&gt;256&lt;/wst:KeySize&gt;
        &lt;wst:RequestedAttachedReference&gt;
            &lt;wsse:SecurityTokenReference
                    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                &lt;wsse:Reference URI="#urn:uuid:84DE938F17D3C897711256051606027"
                                ValueType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/&gt;
            &lt;/wsse:SecurityTokenReference&gt;
        &lt;/wst:RequestedAttachedReference&gt;
        &lt;wst:RequestedUnattachedReference&gt;
            &lt;wsse:SecurityTokenReference
                    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                &lt;wsse:Reference URI="urn:uuid:84DE938F17D3C897711256051606027"
                                ValueType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/&gt;
            &lt;/wsse:SecurityTokenReference&gt;
        &lt;/wst:RequestedUnattachedReference&gt;
        &lt;wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"&gt;
            &lt;wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt;
                &lt;wsa:Address&gt;http://localhost:8081/axis2/services/sample05&lt;/wsa:Address&gt;
            &lt;/wsa:EndpointReference&gt;
        &lt;/wsp:AppliesTo&gt;
        &lt;wst:Lifetime&gt;
            &lt;wsu:Created&gt;2009-10-20T15:13:26.138Z&lt;/wsu:Created&gt;
            &lt;wsu:Expires&gt;2009-10-20T15:13:56.138Z&lt;/wsu:Expires&gt;
        &lt;/wst:Lifetime&gt;
        &lt;wst:RequestedSecurityToken&gt;
            &lt;saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                            ID="urn:uuid:84DE938F17D3C897711256051606027" IssueInstant="2009-10-20T15:13:26.002Z"
                            Version="2.0"&gt;
                &lt;saml:Issuer&gt;SAMPLE_STS&lt;/saml:Issuer&gt;
                    ...
               &lt;/saml:Assertion&gt;
        &lt;/wst:RequestedSecurityToken&gt;
        &lt;wst:RequestedProofToken&gt;
            &lt;wst:ComputedKey&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1&lt;/wst:ComputedKey&gt;
        &lt;/wst:RequestedProofToken&gt;
        &lt;wst:Entropy&gt;
            &lt;wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"&gt;
                r/JgXgGMFb4afwRQpggqky8q4TQm7pdXm8RQq9IgCzI=
            &lt;/wst:BinarySecret&gt;
        &lt;/wst:Entropy&gt;
    &lt;/wst:Reques66tSecurityTokenResponse&gt;
&lt;/wst:RequestSecurityTokenResponseCollection&gt;</pre>
<p>SAML assertion contained in the RSTR is removed for brevity.</p>
<p>In this post, we have looked about the STS Configuration of Apache Rampart, how to obtain a SAML 2.0 Token, and how to use it to consume a web service. If you faced any issues, do not hesitate to post them here.</p>
<pre style="overflow:hidden;position:absolute;left:-10000px;top:3390px;width:1px;height:1px;">&lt;wst:RequestSecurityToken xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512"&gt;
    &lt;wst:RequestType&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue&lt;/wst:RequestType&gt;
    &lt;wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.o383rg/ws/2004/09/policy"&gt;
        &lt;wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt;
            &lt;wsa:Address&gt;http://localhost:8081/axis2/services/sample05&lt;/wsa:Address&gt;
        &lt;/wsa:EndpointReference&gt;
    &lt;/wsp:AppliesTo&gt;
    &lt;wst:Lifetime&gt;
        &lt;wsu:Created&gt;2009-10-20T13:15:51.739Z&lt;/wsu:Created&gt;
        &lt;wsu:Expires&gt;2009-10-20T13:20:51.739Z&lt;/wsu:Expires&gt;
    &lt;/wst:Lifetime&gt;
    &lt;wst:TokenType&gt;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1&lt;/wst:TokenType&gt;
    &lt;wst:KeyType&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey&lt;/wst:KeyType&gt;
    &lt;wst:KeySize&gt;256&lt;/wst:KeySize&gt;
    &lt;wst:Entropy&gt;
        &lt;wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"&gt;
            g5WVRpUl7bKno8LYFC9JUGLpe1NZpkZ/
        &lt;/wst:BinarySecret&gt;
    &lt;/wst:Entropy&gt;
    &lt;wst:ComputedKeyAlgorithm&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1&lt;/wst:ComputedKeyAlgorithm&gt;
&lt;/wst:RequestSecurityToken&gt;</pre>
<pre style="overflow:hidden;position:absolute;left:-10000px;top:3901px;width:1px;height:1px;">&lt;wst:RequestSecurityTokenResponseCollection xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512"&gt;
    &lt;wst:RequestSecurityTokenResponse&gt;
        &lt;wst:TokenType&gt;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0&lt;/wst:TokenType&gt;
        &lt;wst:KeySize&gt;256&lt;/wst:KeySize&gt;
        &lt;wst:RequestedAttachedReference&gt;
            &lt;wsse:SecurityTokenReference
                    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                &lt;wsse:Reference URI="#urn:uuid:84DE938F17D3C897711256051606027"
                                ValueType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/&gt;
            &lt;/wsse:SecurityTokenReference&gt;
        &lt;/wst:RequestedAttachedReference&gt;
        &lt;wst:RequestedUnattachedReference&gt;
            &lt;wsse:SecurityTokenReference
                    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                &lt;wsse:Reference URI="urn:uuid:84DE938F17D3C897711256051606027"
                                ValueType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"/&gt;
            &lt;/wsse:SecurityTokenReference&gt;
        &lt;/wst:RequestedUnattachedReference&gt;
        &lt;wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"&gt;
            &lt;wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt;
                &lt;wsa:Address&gt;http://localhost:8081/axis2/services/sample05&lt;/wsa:Address&gt;
            &lt;/wsa:EndpointReference&gt;
        &lt;/wsp:AppliesTo&gt;
        &lt;wst:Lifetime&gt;
            &lt;wsu:Created&gt;2009-10-20T15:13:26.138Z&lt;/wsu:Created&gt;
            &lt;wsu:Expires&gt;2009-10-20T15:13:56.138Z&lt;/wsu:Expires&gt;
        &lt;/wst:Lifetime&gt;
        &lt;wst:RequestedSecurityToken&gt;
            &lt;saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                            ID="urn:uuid:84DE938F17D3C897711256051606027" IssueInstant="2009-10-20T15:13:26.002Z"
                            Version="2.0"&gt;
                &lt;saml:Issuer&gt;SAMPLE_STS&lt;/saml:Issuer&gt;
                    ...
               &lt;/saml:Assertion&gt;
        &lt;/wst:RequestedSecurityToken&gt;
        &lt;wst:RequestedProofToken&gt;
            &lt;wst:ComputedKey&gt;http://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1&lt;/wst:ComputedKey&gt;
        &lt;/wst:RequestedProofToken&gt;
        &lt;wst:Entropy&gt;
            &lt;wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"&gt;
                r/JgXgGMFb4afwRQpggqky8q4TQm7pdXm8RQq9IgCzI=
            &lt;/wst:BinarySecret&gt;
        &lt;/wst:Entropy&gt;
    &lt;/wst:Reques66tSecurityTokenResponse&gt;
&lt;/wst:RequestSecurityTokenResponseCollection&gt;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/319/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=319&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/10/20/saml-2-0-token-profile-support-in-rampart-1-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>
	</item>
		<item>
		<title>WSO2 SOA Workshop &#8211; Santa Clara, CA</title>
		<link>http://thilinamb.wordpress.com/2009/10/12/wso2-soa-workshop-santa-clara-ca/</link>
		<comments>http://thilinamb.wordpress.com/2009/10/12/wso2-soa-workshop-santa-clara-ca/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 13:21:41 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[wso2]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=310</guid>
		<description><![CDATA[Are you ready to get beyond the hype surrounding Service Oriented Architecture, and learn how to actually implement a real SOA solution? In this full-day interactive workshop, you will learn how to map specific business requirements to concrete SOA development patterns. If you’re ready to gain insight into real-world best practices for SOA, this session [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=310&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Are you ready to get beyond the hype surrounding Service Oriented Architecture, and learn how to actually implement a real SOA solution?</p>
<p>In this full-day interactive workshop, you will learn how to map specific business requirements to concrete SOA development patterns. If you’re ready to gain insight into real-world best practices for SOA, this session is for you.</p>
<h2><a href="http://thilinamb.files.wordpress.com/2009/10/us-soa-workshop-banner.jpg"><img class="aligncenter size-full wp-image-309" title="us-soa-workshop-banner" src="http://thilinamb.files.wordpress.com/2009/10/us-soa-workshop-banner.jpg?w=301&#038;h=317" alt="us-soa-workshop-banner" width="301" height="317" /></a></h2>
<h2><strong>Topics Covered</strong></h2>
<ul>
<li>ESBs and SOA</li>
</ul>
<ul>
<li>SOA Security</li>
</ul>
<ul>
<li>Mashups and Business Process Management for SOA</li>
</ul>
<ul>
<li>SOA Governance</li>
</ul>
<ul>
<li>SOA with C, C++, PHP and more</li>
</ul>
<ul>
<li>SOA Enterprise Architecture Patterns</li>
</ul>
<h2><strong>Date and Time</strong></h2>
<p>November 3 2009<br />
9:00 am to 5:00 pm (Registration at 8:30 am)</p>
<h2><strong>Location</strong></h2>
<p>Network Meeting Center at Techmart<br />
5201 Great America Parkway<br />
Santa Clara, California 95054</p>
<h2 style="text-align:center;"><a href="http://wso2.com/events/2009-us-soa-workshop/?soaotad=10072009" target="_blank">Get registered today.</a></h2>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/310/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=310&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/10/12/wso2-soa-workshop-santa-clara-ca/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>

		<media:content url="http://thilinamb.files.wordpress.com/2009/10/us-soa-workshop-banner.jpg" medium="image">
			<media:title type="html">us-soa-workshop-banner</media:title>
		</media:content>
	</item>
		<item>
		<title>WSO2 Identity Server 2.0.1 Released</title>
		<link>http://thilinamb.wordpress.com/2009/10/09/wso2-identity-server-2-0-1-released/</link>
		<comments>http://thilinamb.wordpress.com/2009/10/09/wso2-identity-server-2-0-1-released/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 17:51:16 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=305</guid>
		<description><![CDATA[The WSO2 Identity Server team is pleased to announce the release of version 2.0.1 of the Open Source WSO2 Identity Server (IS). IS 2.0.1 release is available for download at [1]. This is based on revolutionary the WSO2 Carbon [2] framework, Middleware a la carte&#8217;. All the major features have been developed as pluggable Carbon [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=305&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The WSO2 Identity Server team is pleased to announce the release of<br />
version 2.0.1 of the Open Source WSO2 Identity Server (IS).</p>
<p>IS 2.0.1 release is available for download at [1].</p>
<p>This is based on revolutionary the WSO2 Carbon [2] framework, Middleware<br />
a la carte&#8217;.</p>
<p>All the major features have been developed as pluggable Carbon components.</p>
<p>New Features<br />
&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. SAML 2.0 Token Profile support<br />
2. Passive STS<br />
3. Equinox P2 based provisioning support<br />
4. Improved Support for deploying on top of WebSphere, WebLogic, and<br />
JBoss.<br />
5. Various bug fixes and enhancements including architectural<br />
improvements to Apache Axis2, Apache Rampart, Apache Sandesha2, WSO2<br />
Carbon and other projects</p>
<p>Other Key Features<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Entitlement Engine with XACML 2.0 support.<br />
2. Claim based Security Token Service.<br />
3. Extension points for SAML assertion handling.<br />
4. OpenID Provider<br />
5. Information Card Provider</p>
<p>How to Run<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Extract the downloaded zip.<br />
2. Go to the bin directory in the extracted folder.<br />
3. Run the wso2server.sh or wso2server.bat as appropriate.<br />
4. Point your browser to the URL <a href="https://localhost:9443/carbon" target="_blank">https://localhost:9443/carbon</a><br />
5. Use &#8220;admin&#8221;, &#8220;admin&#8221; as the user name and password.<br />
6. If you need to start the OSGi console with the server use the<br />
property -DosgiConsole when starting the server</p>
<p>Known issues<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
All the known issues have been filed here [3]. Please report any other<br />
issues you find as JIRA entries.</p>
<p>Contact us<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WSO2 Identity Server developers can be contacted via the mailing lists:<br />
For Users: <a href="mailto:carbon-user@wso2.org">carbon-user@wso2.org</a><br />
For Developers: <a href="mailto:carbon-dev@wso2.org">carbon-dev@wso2.org</a></p>
<p>Alternatively, questions can also be raised in the Identity Server forum<br />
at <a href="http://wso2.org/forum/308" target="_blank">http://wso2.org/forum/308</a></p>
<p>Training<br />
&#8212;&#8212;&#8212;&#8212;&#8212;<br />
WSO2 Inc. offers a variety of professional Training Programs, including<br />
training on general Web services as well as WSO2 Identity Server,<br />
Apache Axis2, Data Services and a number of other products. For<br />
additional support information please refer to<br />
<a href="http://wso2.com/training/course-catalog/" target="_blank">http://wso2.com/training/course-catalog/</a></p>
<p>Support<br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WSO2 Inc. offers a variety of development and production support<br />
programs, ranging from Web-based support up through normal business<br />
hours, to premium 24&#215;7 phone support. For additional support information<br />
please refer to <a href="http://wso2.com/support/" target="_blank">http://wso2.com/support/</a></p>
<p>For more information on WSO2 Identity Server, visit the WSO2 Oxygen Tank[4].</p>
<p>Thank you for your interest in WSO2 Identity Server.</p>
<p>-The WSO2 Identity Server team</p>
<p>[1]: <a href="http://wso2.org/downloads/identity" target="_blank">http://wso2.org/downloads/identity</a><br />
[2]: <a href="http://wso2.org/projects/carbon" target="_blank">http://wso2.org/projects/carbon</a><br />
[3]: <a href="https://wso2.org/jira/browse/CARBON" target="_blank">https://wso2.org/jira/browse/CARBON</a><br />
[4]: <a href="http://wso2.org/" target="_blank">http://wso2.org</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/305/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=305&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/10/09/wso2-identity-server-2-0-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>
	</item>
		<item>
		<title>Identity Delegation in WS Trust 1.4</title>
		<link>http://thilinamb.wordpress.com/2009/08/21/identity-delegation-in-ws-trust-1-4/</link>
		<comments>http://thilinamb.wordpress.com/2009/08/21/identity-delegation-in-ws-trust-1-4/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 17:45:57 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[rampart]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=288</guid>
		<description><![CDATA[With the introduction of &#8220;ActAs&#8221; element, WS Trust 1.4 specification facilitates identity delegation. The best way to understand the usage of this element is through a practical scenario. Following use case demonstrates an application of &#8220;ActAs&#8221;. There are two services called service 1 and service 2. Service 2 contains the actual business logic and Alice(service [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=288&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>With the introduction of &#8220;ActAs&#8221; element, <a href="http://docs.oasis-open.org/ws-sx/ws-trust/v1.4/os/ws-trust-1.4-spec-os.html" target="_blank">WS Trust 1.4 specification</a> facilitates identity delegation. The best way to understand the usage of this element is through a practical scenario. Following use case demonstrates an application of &#8220;ActAs&#8221;.</p>
<p>There are two services called service 1 and service 2. Service 2 contains the actual business logic and Alice(service consumer) is interested about it. There is a Security Token Service(STS) which is trusted by both services.</p>
<p><a href="http://thilinamb.files.wordpress.com/2009/08/screenshot.png"><img class="aligncenter size-full wp-image-291" title="Screenshot" src="http://thilinamb.files.wordpress.com/2009/08/screenshot.png?w=569&#038;h=394" alt="Screenshot" width="569" height="394" /></a></p>
<ol>
<li>Alice sends a RST to the STS authenticating herself to the STS. This is a normal RST.</li>
<li>STS returns a SAML Token to Alice in the RSTR. The subject of this SAML token is “Alice”. Let&#8217;s refer to this SAML token as token1.</li>
<li>Alice forwards the token1 with its soap request to service 1. Up to this message transfer, this is same as a usual trust brokering scenario.</li>
<li>Then service1 sends a RST to STS again authenticating itself to the STS. But this time the RST contains the token1 inside the “ActAs” element. (This ActAs element is introduced in the WS Trust 1.4.)</li>
<li>Now the STS issues a SAML token(referred to as token2). The subject of this token is “service1”. But it contains an attribute called “ActAs” with the value of “Alice”.</li>
<li>Then the service1 sends the token2 to “Service2”. Now the service2 understands that the original requester is “Alice” and “Service1” is acting as the original requester by processing the token2.</li>
<li>Then Service1 sends the response to Service2.</li>
<li>Finally, Service1 forwards the response to Alice.</li>
</ol>
<p><a href="http://ws.apache.org/rampart/" target="_blank">Apache Rampart</a> will be supporting <a href="http://docs.oasis-open.org/ws-sx/ws-trust/v1.4/os/ws-trust-1.4-spec-os.html" target="_blank">WS-Trust 1.4 specification</a> soon. So stay tuned..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/288/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=288&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/08/21/identity-delegation-in-ws-trust-1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>

		<media:content url="http://thilinamb.files.wordpress.com/2009/08/screenshot.png" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>How does the SOAP Message Encryption work?</title>
		<link>http://thilinamb.wordpress.com/2009/08/20/soap-message-encryption/</link>
		<comments>http://thilinamb.wordpress.com/2009/08/20/soap-message-encryption/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 20:07:29 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=261</guid>
		<description><![CDATA[WS Security Specification describes enhancements to SOAP messaging to provide message integrity, confidentiality, non-repudiation etc. It does not introduce new information security concepts, rather it is based on the existing security concepts like XML encryption, XML signatures, etc. It sets the foundation to secure web services by adapting these existing technologies accordingly. This post is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=261&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><img class="alignright" title="encryption" src="http://www.webmastersbydesign.com/wp-content/uploads/2008/07/encryption.jpg" alt="" width="250" height="163" />WS Security Specification describes enhancements to SOAP messaging to provide message integrity, confidentiality, non-repudiation etc. It does not introduce new information security concepts, rather it is based on the existing security concepts like XML encryption, XML signatures, etc. It sets the foundation to secure web services by adapting these existing technologies accordingly.</p>
<p>This post is intended to provide a simplified explanation on how XML encryption works with SOAP messages as per the <a href="http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf" target="_blank">WS Security Specification</a>.</p>
<p style="text-align:justify;"><a href="http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf" target="_blank">WS Security Specification</a> recommends to use symmetric keys for encryption. This is mainly due to the low performance factor of asymmetric key based encryption. Even if the asymmetric binding is used, it is advised to use symmetric keys for encryption. In such scenarios, the PKI is used to establish the symmetric keys. Initiator can come up with the symmetric and encrypt it using the public key of the recipient. Then the recipient can decrypt this key and find out the symmetric key which is used for encryption.</p>
<p style="text-align:justify;">It is possible to encrypt the whole XML element or  just the content of it. WS Security Specification enforces not to encrypt &lt;S11:Header&gt;, &lt;S12:Header&gt;, &lt;S11:Envelope&gt;, &lt;S12:Envelope&gt;,or &lt;S11:Body&gt;, &lt;S12:Body&gt; elements. But encrypting the sub elements of those elements are allowed.</p>
<p>If a particular element or content of it is supposed to be encrypted, then that element should be replaced by the &lt;xenc:EncryptedData&gt; element which is the result of encrypting the original element.</p>
<p>Ex :</p>
<pre>&lt;xenc:EncryptedData Id="EncDataId-3" Type="http://www.w3.org/2001/04/xmlenc#Content"&gt;...&lt;/xenc:EncryptedData&gt;</pre>
<p style="text-align:justify;">Symmetric keys used for the encryption operations should be embedded inside &lt;xenc:EncryptedKey&gt; elements. Each &lt;xenc:EncryptedKey&gt; element should contain a &lt;ds:KeyInfo&gt; element that contains information about the key used to encrypt the symmetric key. Then there can be a &lt;xenc:ReferenceList&gt; which is the manifest of the elements which are encrypted. If a &lt;xenc:ReferenceList&gt; element is appearing inside a &lt;xenc:EncryptedKey&gt; element, it implies that the symmetric key resulted by decrypting the cipher value of the &lt;xenc:EncryptedKey&gt; element should be used decrypt the elements specified in that refernce list. &lt;xenc:ReferenceList&gt; is comprised of a list of &lt;xenc:DataReference&gt; elements which contains refernces to the elements which are encrypted using this key. If we put this in a simplified manner, &lt;xenc:ReferenceList&gt; inside a &lt;xenc:EncryptedKey&gt; element refers to all the &lt;xenc:EncryptedData&gt; elements which are encrypted using the symmetric key contained in that  &lt;xenc:EncryptedKey&gt; element. Each &lt;xenc:EncryptedData&gt; element should be referred using &lt;xenc:DataReference&gt; element.</p>
<p>Ex :</p>
<pre>          &lt;xenc:EncryptedKey Id="EncKeyId-E296581B23458CA12512507910022225"&gt;
                &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/&gt;
                &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
                    &lt;wsse:SecurityTokenReference&gt;
                        &lt;wsse:KeyIdentifier
                                EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
                                ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1"&gt;
                            HYL371NzoOs2+IA24VDkBGcUFQM=
                        &lt;/wsse:KeyIdentifier&gt;
                    &lt;/wsse:SecurityTokenReference&gt;
                &lt;/ds:KeyInfo&gt;
                &lt;xenc:CipherData&gt;
                    &lt;xenc:CipherValue&gt;
                        H9l+f1lqTvi4W3vaHwXMhhdfOT8t2t75fzgCkUvjX7ae9FLMEm7/hoQCEurJE4SOmPRXUvLV3MSI21Fcr3HW2OFc1SEpAZQwxma03/iG0jlSyAOOO/j9jitTnmvhtMGI9HShrM0cP77U0GDBTIoXqMSOrzMKbSQ8iz7wl5dG+TY=
                    &lt;/xenc:CipherValue&gt;
                &lt;/xenc:CipherData&gt;
                &lt;xenc:ReferenceList&gt;
                    &lt;xenc:DataReference URI="#EncDataId-3"/&gt;
                &lt;/xenc:ReferenceList&gt;
          &lt;/xenc:EncryptedKey&gt;</pre>
<p style="text-align:justify;">Lets come back to the &lt;xenc:EncryptedData&gt; element. Earlier we said that all the elements which should be encrypted must be replaced by a &lt;xenc:EncryptedData&gt; elements. This element might contain a &lt;ds:KeyInfo&gt; element which points to another &lt;ds:KeyInfo&gt; element or an attached security token. But it is not mandatory to have such &lt;ds:KeyInfo&gt; element, if that &lt;xenc:EncryptedData&gt; element is listed in a &lt;xenc:ReferenceList&gt; of a particuar &lt;xenc:EncryptedKey&gt;. It should contain a &lt;/xenc:CipherData&gt; element, which contains the cipher data.</p>
<p>Ex :</p>
<pre>      &lt;xenc:EncryptedData Id="EncDataId-3" Type="http://www.w3.org/2001/04/xmlenc#Content"&gt;
            &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/&gt;
            &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
                &lt;wsse:SecurityTokenReference
                        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                    &lt;wsse:Reference URI="#EncKeyId-E296581B23458CA12512507910022225"/&gt;
                &lt;/wsse:SecurityTokenReference&gt;
            &lt;/ds:KeyInfo&gt;
            &lt;xenc:CipherData&gt;
                &lt;xenc:CipherValue&gt;HTnMneoskQeLew99eIqCLh+8kUAvKozGjsLMfBN8Ji2QDx64Rl53vKqXYybDQeGidWHn9L7OFSEW
                    6kWuSsDqB+AWQezNgoACcxrNfn7vGwQidD3Kl6aviSaFALzJJkphk29Cip7vSOFmxJn3qIaA82AD
                    rrnPYT57uyPh03XELwrv1Wret3q1uNZ0pnjk6xjYjsQzkAgADUeE/MfWSMdjvpZ6eQ4wwTOmemeh
                    HtVLEdIsKoCyXRBMC9Etiu3KoymArNWRAMgQHvSzBmGxuWCALOHYru8OJpmetZacz5KVqWHifRhP
                    wXFsWOQF3zfBQhJmf4fRiAXkeJ4ZXn3BjT4dz/BVoDaHJFEwK5KY9GRtg0U7Eu3l5k6RNM3ds56N
                    PGP/DhvKJfcFCh4qKVfbWFDVLdeqcRzrHXWuiHTu6BoiwJgzFoQ8vjP6Bw==
                &lt;/xenc:CipherValue&gt;
            &lt;/xenc:CipherData&gt;
        &lt;/xenc:EncryptedData&gt;</pre>
<p style="text-align:justify;">Having said about the optional &lt;ds:KeyInfo&gt; element inside a &lt;xenc:EncryptedData&gt; element, now it is possible to take the &lt;xenc:ReferenceList&gt; element out of the &lt;xenc:EncryptedKey&gt; element if required. In such scenarios, &lt;xenc:EncryptedData&gt; elements should contain the &lt;ds:KeyInfo&gt; elements pointing to the keys that are used for the encryption. With this option, it is possible to use multiple keys for encrypting the elements in the same SOAP message.</p>
<p>So lets bring all the bits and pieces together. Following listing depicts a SOAP message with an encrypted soap body.</p>
<pre>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"&gt;
    &lt;soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"&gt;
        &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                       soapenv:mustUnderstand="1"&gt;
            &lt;xenc:EncryptedKey Id="EncKeyId-E296581B23458CA12512507910022225"&gt;
                &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/&gt;
                &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
                    &lt;wsse:SecurityTokenReference&gt;
                        &lt;wsse:KeyIdentifier
                                EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
                                ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1"&gt;
                            HYL371NzoOs2+IA24VDkBGcUFQM=
                        &lt;/wsse:KeyIdentifier&gt;
                    &lt;/wsse:SecurityTokenReference&gt;
                &lt;/ds:KeyInfo&gt;
                &lt;xenc:CipherData&gt;
                    &lt;xenc:CipherValue&gt;
                        H9l+f1lqTvi4W3vaHwXMhhdfOT8t2t75fzgCkUvjX7ae9FLMEm7/hoQCEurJE4SOmPRXUvLV3MSI21Fcr3HW2OFc1SEpAZQwxma03/iG0jlSyAOOO/j9jitTnmvhtMGI9HShrM0cP77U0GDBTIoXqMSOrzMKbSQ8iz7wl5dG+TY=
                    &lt;/xenc:CipherValue&gt;
                &lt;/xenc:CipherData&gt;
                &lt;xenc:ReferenceList&gt;
                    &lt;xenc:DataReference URI="#EncDataId-3"/&gt;
                &lt;/xenc:ReferenceList&gt;
            &lt;/xenc:EncryptedKey&gt;
        &lt;/wsse:Security&gt;
        &lt;wsa:To&gt;http://localhost:8081/axis2/services/sample03&lt;/wsa:To&gt;
        &lt;wsa:MessageID&gt;urn:uuid:EE5C34B1DCEF6DBA991250791000372&lt;/wsa:MessageID&gt;
        &lt;wsa:Action&gt;urn:echo&lt;/wsa:Action&gt;
    &lt;/soapenv:Header&gt;
    &lt;soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                  wsu:Id="Id-14900151"&gt;
        &lt;xenc:EncryptedData Id="EncDataId-3" Type="http://www.w3.org/2001/04/xmlenc#Content"&gt;
            &lt;xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/&gt;
            &lt;ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
                &lt;wsse:SecurityTokenReference
                        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                    &lt;wsse:Reference URI="#EncKeyId-E296581B23458CA12512507910022225"/&gt;
                &lt;/wsse:SecurityTokenReference&gt;
            &lt;/ds:KeyInfo&gt;
            &lt;xenc:CipherData&gt;
                &lt;xenc:CipherValue&gt;HTnMneoskQeLew99eIqCLh+8kUAvKozGjsLMfBN8Ji2QDx64Rl53vKqXYybDQeGidWHn9L7OFSEW
                    6kWuSsDqB+AWQezNgoACcxrNfn7vGwQidD3Kl6aviSaFALzJJkphk29Cip7vSOFmxJn3qIaA82AD
                    rrnPYT57uyPh03XELwrv1Wret3q1uNZ0pnjk6xjYjsQzkAgADUeE/MfWSMdjvpZ6eQ4wwTOmemeh
                    HtVLEdIsKoCyXRBMC9Etiu3KoymArNWRAMgQHvSzBmGxuWCALOHYru8OJpmetZacz5KVqWHifRhP
                    wXFsWOQF3zfBQhJmf4fRiAXkeJ4ZXn3BjT4dz/BVoDaHJFEwK5KY9GRtg0U7Eu3l5k6RNM3ds56N
                    PGP/DhvKJfcFCh4qKVfbWFDVLdeqcRzrHXWuiHTu6BoiwJgzFoQ8vjP6Bw==
                &lt;/xenc:CipherValue&gt;
            &lt;/xenc:CipherData&gt;
        &lt;/xenc:EncryptedData&gt;
    &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
<p style="text-align:justify;">An asymmetric key is used for encrption. &lt;xenc:EncryptedKey&gt; element contains a &lt;ds:KeyInfo&gt; element which can be used by the recipient to locate the correct private key from his keystore to decrypt the symmetric key. &lt;wsse:SecurityTokenReference&gt; element inside that &lt;ds:KeyInfo&gt; element specifies a ThumbprintSHA1 value that can be used as a key identifier. Then it contains a &lt;xenc:CipherData&gt; which contains the cipher text of the symmetric key. Decrypting this cipher text using the private key of the recipient with result with the symmetric key.</p>
<p style="text-align:justify;">Then it has the &lt;xenc:ReferenceList&gt; with a single &lt;xenc:DataReference&gt; element. That &lt;xenc:DataReference&gt; element refers to an element using the URI fragment #EncDataId-3. If you carefully observe, you will note that, this URI fragment is the ID of the &lt;xenc:EncryptedData&gt; which is the child element of the soap body. That &lt;xenc:EncryptedData&gt; element contains a &lt;ds:KeyInfo&gt; element which points to the &lt;xenc:EncryptedKey&gt; element mentioned above using a SecurityToken Reference. &lt;xenc:CipherValue&gt; contains the encrypted content of the soap body, which should be decrypted using the symmetric key.</p>
<p>I did not discussed about encrypting SOAP headers, to keep this note short as much as possible.</p>
<p>Refer to <a href="http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf" target="_blank">WS Security Specification</a> for a comprehensive description about the SOAP message encryption.</p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:0;width:1px;height:1px;">&lt;soapenv:Envelope xmlns:soapenv=&#8221;http://schemas.xmlsoap.org/soap/envelope/&#8221;<br />
xmlns:xenc=&#8221;http://www.w3.org/2001/04/xmlenc#&#8221;&gt;<br />
&lt;soapenv:Header xmlns:wsa=&#8221;http://www.w3.org/2005/08/addressing&#8221;&gt;<br />
&lt;wsse:Security xmlns:wsse=&#8221;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&#8221;<br />
soapenv:mustUnderstand=&#8221;1&#8243;&gt;<br />
&lt;xenc:EncryptedKey Id=&#8221;EncKeyId-E296581B23458CA12512507910022225&#8243;&gt;<br />
&lt;xenc:EncryptionMethod Algorithm=&#8221;http://www.w3.org/2001/04/xmlenc#rsa-1_5&#8243;/&gt;<br />
&lt;ds:KeyInfo xmlns:ds=&#8221;http://www.w3.org/2000/09/xmldsig#&#8221;&gt;<br />
&lt;wsse:SecurityTokenReference&gt;<br />
&lt;wsse:KeyIdentifier<br />
EncodingType=&#8221;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary&#8221;<br />
ValueType=&#8221;http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1&#8243;&gt;<br />
HYL371NzoOs2+IA24VDkBGcUFQM=<br />
&lt;/wsse:KeyIdentifier&gt;<br />
&lt;/wsse:SecurityTokenReference&gt;<br />
&lt;/ds:KeyInfo&gt;<br />
&lt;xenc:CipherData&gt;<br />
&lt;xenc:CipherValue&gt;<br />
H9l+f1lqTvi4W3vaHwXMhhdfOT8t2t75fzgCkUvjX7ae9FLMEm7/hoQCEurJE4SOmPRXUvLV3MSI21Fcr3HW2OFc1SEpAZQwxma03/iG0jlSyAOOO/j9jitTnmvhtMGI9HShrM0cP77U0GDBTIoXqMSOrzMKbSQ8iz7wl5dG+TY=<br />
&lt;/xenc:CipherValue&gt;<br />
&lt;/xenc:CipherData&gt;<br />
&lt;xenc:ReferenceList&gt;<br />
&lt;xenc:DataReference URI=&#8221;#EncDataId-3&#8243;/&gt;<br />
&lt;/xenc:ReferenceList&gt;<br />
&lt;/xenc:EncryptedKey&gt;<br />
&lt;/wsse:Security&gt;<br />
&lt;wsa:To&gt;http://localhost:8081/axis2/services/sample03&lt;/wsa:To&gt;<br />
&lt;wsa:MessageID&gt;urn:uuid:EE5C34B1DCEF6DBA991250791000372&lt;/wsa:MessageID&gt;<br />
&lt;wsa:Action&gt;urn:echo&lt;/wsa:Action&gt;<br />
&lt;/soapenv:Header&gt;<br />
&lt;soapenv:Body xmlns:wsu=&#8221;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&#8221;<br />
wsu:Id=&#8221;Id-14900151&#8243;&gt;<br />
&lt;xenc:EncryptedData Id=&#8221;EncDataId-3&#8243; Type=&#8221;http://www.w3.org/2001/04/xmlenc#Content&#8221;&gt;<br />
&lt;xenc:EncryptionMethod Algorithm=&#8221;http://www.w3.org/2001/04/xmlenc#tripledes-cbc&#8221;/&gt;<br />
&lt;ds:KeyInfo xmlns:ds=&#8221;http://www.w3.org/2000/09/xmldsig#&#8221;&gt;<br />
&lt;wsse:SecurityTokenReference<br />
xmlns:wsse=&#8221;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&#8221;&gt;<br />
&lt;wsse:Reference URI=&#8221;#EncKeyId-E296581B23458CA12512507910022225&#8243;/&gt;<br />
&lt;/wsse:SecurityTokenReference&gt;<br />
&lt;/ds:KeyInfo&gt;<br />
&lt;xenc:CipherData&gt;<br />
&lt;xenc:CipherValue&gt;HTnMneoskQeLew99eIqCLh+8kUAvKozGjsLMfBN8Ji2QDx64Rl53vKqXYybDQeGidWHn9L7OFSEW<br />
6kWuSsDqB+AWQezNgoACcxrNfn7vGwQidD3Kl6aviSaFALzJJkphk29Cip7vSOFmxJn3qIaA82AD<br />
rrnPYT57uyPh03XELwrv1Wret3q1uNZ0pnjk6xjYjsQzkAgADUeE/MfWSMdjvpZ6eQ4wwTOmemeh<br />
HtVLEdIsKoCyXRBMC9Etiu3KoymArNWRAMgQHvSzBmGxuWCALOHYru8OJpmetZacz5KVqWHifRhP<br />
wXFsWOQF3zfBQhJmf4fRiAXkeJ4ZXn3BjT4dz/BVoDaHJFEwK5KY9GRtg0U7Eu3l5k6RNM3ds56N<br />
PGP/DhvKJfcFCh4qKVfbWFDVLdeqcRzrHXWuiHTu6BoiwJgzFoQ8vjP6Bw==<br />
&lt;/xenc:CipherValue&gt;<br />
&lt;/xenc:CipherData&gt;<br />
&lt;/xenc:EncryptedData&gt;<br />
&lt;/soapenv:Body&gt;<br />
&lt;/soapenv:Envelope&gt;</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/261/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=261&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/08/20/soap-message-encryption/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>

		<media:content url="http://www.webmastersbydesign.com/wp-content/uploads/2008/07/encryption.jpg" medium="image">
			<media:title type="html">encryption</media:title>
		</media:content>
	</item>
		<item>
		<title>WS Security Policy &#8211; Asymmetric Binding Explained&#8230;</title>
		<link>http://thilinamb.wordpress.com/2009/08/19/ws-security-policy-assymetric-binding-explained/</link>
		<comments>http://thilinamb.wordpress.com/2009/08/19/ws-security-policy-assymetric-binding-explained/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 20:04:59 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[axis2]]></category>
		<category><![CDATA[rampart]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=231</guid>
		<description><![CDATA[In this post, I am trying to explain the Assymetric Binding defined in WS Security Policy Specification. First I will explain what the Asymmetric Binding is, and then I will take you through a sample scenario using Apache Rampart. WS Security Policy Specification defines three security binding assertions, namely Transport Binding, Symmetric Binding and Asymmetric [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=231&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">In this post, I am trying to explain the Assymetric Binding defined in <a href="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.2/ws-securitypolicy.html" target="_blank">WS Security Policy Specification</a>. First I will explain what the Asymmetric Binding is, and then I will take you through a sample scenario using <a href="http://ws.apache.org/rampart/" target="_blank">Apache Rampart</a>.</p>
<p style="text-align:justify;">WS Security Policy Specification defines three security binding assertions, namely Transport Binding, Symmetric Binding and Asymmetric Binding. All these bindings are ideal for different use cases and only the Asymmetric Binding is discussed in detail in this post.</p>
<p><strong>What is Assymetric Binding ?</strong></p>
<p style="text-align:justify;">According to the WS Security Specification, “The AsymmetricBinding assertion is used in scenarios in which message protection is provided by means defined in WSS: SOAP Message Security using asymmetric key (Public Key) technology”. If we put this in a simplified manner, Asymmetric Binding can be used when both parties possess key pairs. For example, if both the parties possess X.509 certificates, then it is possible to use asymmetric binding.</p>
<p style="text-align:justify;">In asymmetric binding, message encryption and signing takes place using the Public Key Infrastructure(PKI), i.e. sender encrypts messages using the public key of the recipient and sign the messages using his private key. Then the recipient can decrypt the received messages using his private key and verify the signature of the message using the public key of the sender. This way, the confidentiality, integrity and the non-repudiation properties of the message exchanges can be assured.</p>
<p>Following diagram explains how asymmetric binding works.</p>
<p><a href="http://thilinamb.files.wordpress.com/2009/08/asymmetric1.jpg"><img class="aligncenter size-full wp-image-237" title="asymmetric" src="http://thilinamb.files.wordpress.com/2009/08/asymmetric1.jpg?w=480&#038;h=203" alt="asymmetric" width="480" height="203" /></a></p>
<p><strong>Asymmetric Binding Policy Assertion</strong></p>
<p>Following is a sample Asymmetric Binding policy assertion.</p>
<pre>&lt;sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
    &lt;wsp:Policy&gt;
       &lt;sp:InitiatorToken&gt;
          &lt;wsp:Policy&gt;
             &lt;sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt;
                 &lt;wsp:Policy&gt;
                     &lt;sp:RequireThumbprintReference/&gt;
                     &lt;sp:WssX509V3Token10/&gt;
                 &lt;/wsp:Policy&gt;
            &lt;/sp:X509Token&gt;
          &lt;/wsp:Policy&gt;
       &lt;/sp:InitiatorToken&gt;
       &lt;sp:RecipientToken&gt;
          &lt;wsp:Policy&gt;
             &lt;sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"&gt;
                 &lt;wsp:Policy&gt;
                     &lt;sp:RequireThumbprintReference/&gt;
                     &lt;sp:WssX509V3Token10/&gt;
                 &lt;/wsp:Policy&gt;
            &lt;/sp:X509Token&gt;
        &lt;/wsp:Policy&gt;
       &lt;/sp:RecipientToken&gt;
       &lt;sp:AlgorithmSuite&gt;
          &lt;wsp:Policy&gt;
             &lt;sp:TripleDesRsa15/&gt;
          &lt;/wsp:Policy&gt;
       &lt;/sp:AlgorithmSuite&gt;
       &lt;sp:Layout&gt;
          &lt;wsp:Policy&gt;
             &lt;sp:Strict/&gt;
          &lt;/wsp:Policy&gt;
       &lt;/sp:Layout&gt;
       &lt;sp:IncludeTimestamp/&gt;
       &lt;sp:OnlySignEntireHeadersAndBody/&gt;
     &lt;/wsp:Policy&gt;
 &lt;/sp:AsymmetricBinding&gt;</pre>
<p style="text-align:justify;">In asymmetric binding scenario, keys used for signature and encrypting should be clearly specified. This is facilitated in the Assymetric Binding assertion itself. An assymetric binding usually contains two main elements, <em>InitiatorToken</em> and <em>RecipientToken. </em>These tokens provides room for specifying the tokens used in the signing/encrypting operations by the sender(initiator) and recipient respectively. According to the specification, each of these two elements should contain tokens used for signing and encrypting. In this policy, X.509 certificate is used for signing/encrypting at each end. This is specified using a X.509 supporting token.</p>
<p>In addition to those two elements, other properties like Algorithmic Suite, IncludeTimeStamp can also be specified in the Asymmetric Binding element similar to other security binding assertions.</p>
<p><strong>Rampart Configuration</strong></p>
<p>Although we have specified that we are using a X.509 certificates for signing and encrypting in the policy, there should be a way to point to those certificates from both ends. Now the Rampart Configuration element comes into play. Following is the Rampart-Config of the client side. Server side should also contain a RampartConfig element which is almost similar to this.</p>
<pre>&lt;ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy"&gt;
    &lt;ramp:userCertAlias&gt;client&lt;/ramp:userCertAlias&gt;
    &lt;ramp:encryptionUser&gt;service&lt;/ramp:encryptionUser&gt;
    &lt;ramp:passwordCallbackClass&gt;org.apache.rampart.asymm.PWCBHandler&lt;/ramp:passwordCallbackClass&gt;

    &lt;ramp:signatureCrypto&gt;
       &lt;ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"&gt;
          &lt;ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type"&gt;JKS&lt;/ramp:property&gt;
          &lt;ramp:property name="org.apache.ws.security.crypto.merlin.file"&gt;
            /path/to/client.jks&lt;/ramp:property&gt;
          &lt;ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password"&gt;apache&lt;/ramp:property&gt;
       &lt;/ramp:crypto&gt;
    &lt;/ramp:signatureCrypto&gt;
&lt;/ramp:RampartConfig&gt;</pre>
<p>Lets go through each of these elements.</p>
<p><em>&lt;ramp:userCertAlias</em><em>&gt;</em> &#8211; alias of the key used for signing.</p>
<p><em>&lt;ramp:encryptionUser&gt;</em> &#8211; used to identify the key that is used to encrypt, i.e. alias of the recipient&#8217;s certificate.</p>
<p><em>&lt;ramp:passwordCallbackClass&gt;</em> &#8211; used to get the password of the private key that is used for signing.</p>
<p style="text-align:justify;"><em>&lt;ramp:signatureCrypto&gt;</em> &#8211; information about the key store that contains the necessary keys. Here, we are providing the keystore type, location and keystore password. This element only defines the keystore that contains the keys used for signing. Similarly there can be a another element called <em>encryptionCypto</em> containg keystore information used for encryption. In Rampart, if this element is not specified, properties defined in <em>ramp:signatureCrypto </em>element is used for encryption operations.</p>
<p><strong>Policy</strong></p>
<p>Following listing is the policy I have used in this sample. Since the Asymmetric Binding assertion is provided before I have removed that assertion from the policy for the brevity.</p>
<pre>?xml version="1.0" encoding="UTF-8"?&gt;
&lt;wsp:Policy wsu:Id="SigOnly"  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
          xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"&gt;
    &lt;wsp:ExactlyOne&gt;
      &lt;wsp:All&gt;
         &lt;sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
               ....
         &lt;/sp:AsymmetricBinding&gt;
         &lt;sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;wsp:Policy&gt;
                &lt;sp:MustSupportRefKeyIdentifier/&gt;
                &lt;sp:MustSupportRefIssuerSerial/&gt;
            &lt;/wsp:Policy&gt;
         &lt;/sp:Wss10&gt;
         &lt;sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;sp:Body/&gt;
         &lt;/sp:SignedParts&gt;
       &lt;/wsp:All&gt;
   &lt;/wsp:ExactlyOne&gt;
&lt;/wsp:Policy&gt;</pre>
<p>The body of the soap message should be singed according to the policy.</p>
<p>Please note that the corresponding RampartConfig elements should also be appended to the policy. The complete policy.xml and the services.xml files can be found in the <a href="http://builder.wso2.org/~carbon/thilina/asymm-binding-resources.zip" target="_blank">resources</a>.</p>
<p><strong>Service</strong></p>
<p>I am using a simple echo service in this sample. The service class looks similar to this.</p>
<pre>public class SimpleService {
  public String echo(String arg) {
      return arg;
  }
}</pre>
<p>This service file can be found in the resources.</p>
<p><strong>Client</strong></p>
<pre>package org.apache.rampart.asymm;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyEngine;
import org.apache.rampart.RampartMessageData;

public class AsymmBindingClient {
     public static void main(String[] args) throws Exception {

       String repo = "/path/to/repo";
       String EPR = "http://localhost:8080/axis2/services/sample02";
       String policyPath = "/path/to/policy.xml";

       // instantiating a ConfigurationContext object pointing to a Axis2 repository.
       ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo, null);

       ServiceClient client = new ServiceClient(ctx, null);

       //Setting the properties to the service client.
       Options options = new Options();
       options.setAction("urn:echo");
       options.setTo(new EndpointReference(EPR));
       options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(policyPath));
       client.setOptions(options);

       // engage modules
       client.engageModule("addressing");
       client.engageModule("rampart");

       //invoke the web service
       OMElement response = client.sendReceive(getPayload("Hello world"));

       System.out.println(response);

   }

    private static Policy loadPolicy(String xmlPath) throws Exception {
       StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
       return PolicyEngine.getPolicy(builder.getDocumentElement());
   }

   private static OMElement getPayload(String value) {
      OMFactory factory = OMAbstractFactory.getOMFactory();
      OMNamespace ns = factory.createOMNamespace("http://sample02.policy.samples.rampart.apache.org", "ns1");
      OMElement elem = factory.createOMElement("echo", ns);
      OMElement childElem = factory.createOMElement("param0", ns);
      childElem.setText(value);
      elem.addChild(childElem);

      return elem;
   }
}</pre>
<p style="text-align:justify;">Since we have used policy based configuration, most of the rampart configuration is done at the policy. So this class is simple. If you have already gone through my <a href="http://thilinamb.wordpress.com/2009/08/18/securing-a-web-service-with-username-token-https-with-apache-rampart/" target="_blank">previous post</a> about using username token + HTTPS to secure a web service, it is easy to understand this code.</p>
<p><strong>Request and Response</strong></p>
<p style="text-align:justify;">You can find both the request and response generated in this service invocation in the <a href="http://builder.wso2.org/~carbon/thilina/asymm-binding-resources.zip" target="_blank">resources</a>. You will see that the body of the SOAP message is signed using the private key of the sender. So the recipient can verify that signature using the ppublic key of the sender.</p>
<p style="text-align:justify;">Image Courtesy : <a href="http://wso2.org/library/3132" target="_blank">Understanding WS – Security Policy Language</a> by <a href="http://nandana83.blogspot.com" target="_blank">Nandana Mihindukulasooriya.</a></p>
<p style="text-align:justify;">
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=231&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/08/19/ws-security-policy-assymetric-binding-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>

		<media:content url="http://thilinamb.files.wordpress.com/2009/08/asymmetric1.jpg" medium="image">
			<media:title type="html">asymmetric</media:title>
		</media:content>
	</item>
		<item>
		<title>Securing a Web Service with Username Token + HTTPS with Apache Rampart</title>
		<link>http://thilinamb.wordpress.com/2009/08/18/securing-a-web-service-with-username-token-https-with-apache-rampart/</link>
		<comments>http://thilinamb.wordpress.com/2009/08/18/securing-a-web-service-with-username-token-https-with-apache-rampart/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 17:36:04 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[rampart]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wso2]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=200</guid>
		<description><![CDATA[This post has been moved to : http://blog.thilinamb.com/2009/08/securing-web-service-with-username.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=200&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post has been moved to : <a href="http://blog.thilinamb.com/2009/08/securing-web-service-with-username.html">http://blog.thilinamb.com/2009/08/securing-web-service-with-username.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=200&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/08/18/securing-a-web-service-with-username-token-https-with-apache-rampart/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>
	</item>
		<item>
		<title>WSO2 Identity Server 2.0.0 is released.</title>
		<link>http://thilinamb.wordpress.com/2009/07/22/wso2-identity-server-2-0-0-is-released/</link>
		<comments>http://thilinamb.wordpress.com/2009/07/22/wso2-identity-server-2-0-0-is-released/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 09:44:31 +0000</pubDate>
		<dc:creator>thilinamb</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://thilinamb.wordpress.com/?p=189</guid>
		<description><![CDATA[The WSO2 Identity Server team is pleased to announce the release of version 2.0.0 of the Open Source WSO2 Identity Server (IS). IS 2.0.0 release is available for download at [1]. This is based on revolutionary the WSO2 Carbon [2] framework, Middleware a la carte&#8217;. All the major features have been developed as pluggable Carbon [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=189&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="IS2" src="http://wso2.org/themes/wso2_v5/images/identity_logo.gif" alt="" width="272" height="42" /></p>
<div>The WSO2 Identity Server team is pleased to announce the release of version 2.0.0 of the Open Source WSO2 Identity Server (IS).</p>
<p>IS 2.0.0 release is available for download at [1].</p>
<p>This is based on revolutionary the WSO2 Carbon [2] framework, Middleware a la carte&#8217;.</p>
<p>All the major features have been developed as pluggable Carbon components.</p>
<p>New Features<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Entitlement Engine with XACML 2.0 support.<br />
2. Claim based Security Token Service.<br />
3. Extension points for SAML assertion handling.<br />
4. XMPP based multi-factor authentication.<br />
5. Improved User Management.<br />
6. Claim Management.<br />
7. User Profiles and Profile Management.<br />
8. XKMS.<br />
9. Separable front-end &amp; back-end &#8211; a single front-end server can be used to administer several back-end servers.<br />
10. Bug fixes and enhancements.</p>
<p>Other Features<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Information cards provider supporting Managed Information Cards backed by user name / password and self-issued cards.<br />
2. Information cards support for SAML 1.1/2.0 token profiles.<br />
3. OpenID provider.<br />
4. Multi-factor authentication with information cards.</p>
<p>How to Run<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1. Extract the downloaded zip.<br />
2. Go to the bin directory in the extracted folder.<br />
3. Run the wso2server.sh or wso2server.bat as appropriate.<br />
4. Point your browser to the URL <a href="https://localhost:9443/carbon" target="_blank">https://localhost:9443/carbon</a><br />
5. Use &#8220;admin&#8221;, &#8220;admin&#8221; as the user name and password.<br />
6. If you need to start the OSGi console with the server use the property -DosgiConsole when starting the server</p>
<p>Known issues<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
All the known issues have been filed here [3],[4]. Please report any other issues you find as JIRA entries.</p></div>
<div>Contact us</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
WSO2 Identity Server developers can be contacted via the mailing lists:<br />
For Users: <a href="mailto:identity-user@wso2.org" target="_blank">identity-user@wso2.org</a><br />
For Developers: <a href="mailto:identity-dev@wso2.org" target="_blank">identity-dev@wso2.org</a></div>
<div>Alternatively, questions can also be raised in the Identity Server forum at <a href="http://wso2.org/forum/308" target="_blank">http://wso2.org/forum/308</a></div>
<div>Training</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8212;<br />
WSO2 Inc. offers a variety of professional Training Programs, including training on general Web services as well as WSO2 Identity Server,<br />
Apache Axis2, Data Services and a number of other products. For additional support information please refer to <a href="http://wso2.com/training/course-catalog/" target="_blank">http://wso2.com/training/course-catalog/</a></div>
<div>Support</div>
<div>&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div>WSO2 Inc. offers a variety of development and production support programs, ranging from Web-based support up through normal business<br />
hours, to premium 24&#215;7 phone support. For additional support information please refer to <a href="http://wso2.com/support/" target="_blank">http://wso2.com/support/</a></div>
<div>For more information on WSO2 Identity Server, visit the WSO2 OxygenTank[5].</div>
<div>Thank you for your interest in WSO2 Identity Server.</div>
<div>
-The WSO2 Identity Server team</div>
<div>
[1]: <a href="http://wso2.org/downloads/identity" target="_blank">http://wso2.org/downloads/identity</a><br />
[2]: <a href="http://wso2.org/projects/carbon" target="_blank">http://wso2.org/projects/carbon</a><br />
[3]: <a href="https://wso2.org/jira/browse/CARBON" target="_blank">https://wso2.org/jira/browse/CARBON</a></div>
<div>[4]: <a href="https://wso2.org/jira/browse/IDENTITY" target="_blank">https://wso2.org/jira/browse/IDENTITY</a></div>
<div>[5]: <a href="http://wso2.org/" target="_blank">http://wso2.org</a></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/thilinamb.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/thilinamb.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/thilinamb.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/thilinamb.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/thilinamb.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/thilinamb.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/thilinamb.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/thilinamb.wordpress.com/189/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=thilinamb.wordpress.com&amp;blog=2944195&amp;post=189&amp;subd=thilinamb&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://thilinamb.wordpress.com/2009/07/22/wso2-identity-server-2-0-0-is-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/85607f91c3295e7fe6bdada1224bfd36?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">thilinamb</media:title>
		</media:content>

		<media:content url="http://wso2.org/themes/wso2_v5/images/identity_logo.gif" medium="image">
			<media:title type="html">IS2</media:title>
		</media:content>
	</item>
	</channel>
</rss>
