WCF Custom Bindings for Axis2
Sample Java Client Implementation Guide
I
1.0 P rerequisites 1. Eclipse IDE 2. Subversion Client 3. JDK 1.6 4. Patch the JDK with java unlimited key strength files 2.0 S etting up the samples 1. Get an SVN check out of the java client code C:\> svn co https://svn.wso2.org/repos/wso2/people/prabath security-‐interop This will check out all the sample code to c:\security-‐interop folder 2. Start Eclipse and create a new workspace. 3. Import all the projects from c:\security-‐interop folder to the Eclipse workspace. 4. Right click on any eclipse project imported to the workspace à Properties à Java Build Path à Add Variable à Configure Variables à New à Set Name to SAMPLES_HOME and Path to c:\ security-‐interop 5. Build all the projects in the workspace, Project à Build All 3.0 K eys to setup at the WCF service end Public key and the private key used with all the java clients can be downloaded from https://svn.wso2.org/repos/wso2/people/prabath/keys 4.0 K ey store details used at the client end Key store name Key store password Private key password Private key alias Location
: wso2carbon.jks : wos2carbon : wso2carbon : wso2carbon : c:\ security-‐interop\lib
5.0 W SDL location of the sample service https://svn.wso2.org/repos/wso2/people/prabath/wsdl/service.wsdl
II
6.0 S ample Guide Sample Project org.apache.rampart.security.policy1 Description Transport binding / UsernameToken as SignedSupportingTokens Security Policy https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐1.xml Notes 1. In the EchoServiceClient.java you need to change the user name and password of the user to be appropriate to the setup. client.getOptions().setPassword("admin"); client.getOptions().setUserName("admin"); 2. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. Sample Project Description Security Policy Notes
Sample Project Description Security Policy Notes
org.apache.rampart.security.policy2 AsymmetricBinding / Sign and Encrypt https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐2.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP.
org.apache.rampart.security.policy3 SymmetricBinding / Sign and Encrypt with UsernameToken Authentication https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐3.xml 1. In the EchoServiceClient.java you need to change the user name and password of the user to be appropriate to the setup. client.getOptions().setPassword("admin"); client.getOptions().setUserName("admin"); 2. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. III
Sample Project Description Security Policy Notes
Sample Project Description Security Policy Notes
Sample Project Description Security Policy STS Policy Notes
org.apache.rampart.security.policy4 SymmetricBinding / Sign only https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐4.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP.
org.apache.rampart.security.policy5 AsymmetricBinding / Sign only https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐5.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP.
org.apache.rampart.security.policy6 SecureConversation -‐ Sign only -‐ Service as STS -‐ Bootstrap policy -‐ Sign and Encrypt , X509 Authentication https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐6.xml https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐6.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. 2. Set STS_EPR in EchoServiceClient.java to the correct WCF EP.
IV
Sample Project Description Security Policy STS Policy Notes
Sample Project Description Security Policy STS Policy Notes
org.apache.rampart.security.policy7 SecureConversation -‐ Sign and Encrypt -‐ Service as STS – Bootstrap policy -‐ Sign and Encrypt , X509 Authentication https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐7.xml https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐7-‐1.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. 2. Set STS_EPR in EchoServiceClient.java to the correct WCF EP.
org.apache.rampart.security.policy8 SecureConversation -‐ Sign and Encrypt -‐ Service as STS – Bootstrap policy -‐ Sign and Encrypt , Anonymous clients https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐8.xml https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐8-‐1.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. 2. Set STS_EPR in EchoServiceClient.java to the correct WCF EP.
V
Sample Project Description
Security Policy STS Policy Notes
Sample Project Description Security Policy Notes
References
org.apache.rampart.security.policy9 SecureConversation -‐ Sign and Encrypt -‐ Service as STS – Bootstrap policy -‐ Sign and Encrypt , Username Token Authentication https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐9.xml https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐9-‐1.xml 1. In the EchoServiceClient.java you need to change the user name and password of the user to be appropriate to the setup. client.getOptions().setPassword("admin"); client.getOptions().setUserName("admin"); stsOptions.setPassword("admin"); stsOptions.setUserName("admin"); 2. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. 3. Set STS_EPR in EchoServiceClient.java to the correct WCF EP.
org.apache.rampart.security.policy10 SymmetricBinding / WssGssKerberosV5ApReqToken11 https://svn.wso2.org/repos/wso2/people/prabath/service-‐ policies/policy-‐10.xml 1. Set RELYING_PARTY_SERVICE_EPR in EchoServiceClient.java to the correct WCF EP. 1. Kerberos authentication with WCF Service and WCF Client , http://blog.facilelogin.com/2010/12/kerberos-‐ authentication-‐with-‐wcf.html 2. Kerberos authentication with WCF Service and Java Client, http://blog.facilelogin.com/2010/12/kerberos-‐ authentication-‐with-‐wcf_04.html 3. Kerberos authentication with WSO2 ESB , http://blog.facilelogin.com/2010/12/kerberos-‐ authentication-‐with-‐wso2-‐esb.html 4. Invoking a WCF service secured with Kerberos via WSO2 ESB, http://blog.facilelogin.com/2010/12/invoking-‐wcf-‐ service-‐secured-‐with.html
VI