<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Kumar Jayanti&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/" />
<modified>2007-12-07T09:01:18Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/kumarjayanti/399</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2007, kumarjayanti</copyright>
<entry>
<title>Accessing the SAML Assertion in the WebService</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/archive/2007/12/accessing_the_s.html" />
<modified>2007-12-07T09:01:18Z</modified>
<issued>2007-12-07T09:01:12Z</issued>
<id>tag:weblogs.java.net,2007:/blog/kumarjayanti/399.8777</id>
<created>2007-12-07T09:01:12Z</created>
<summary type="text/plain">When Using WSIT Secure Scenarios containing SAML Assertion, How do i access the SAML Assertion on the Server?</summary>
<author>
<name>kumarjayanti</name>

<email>Vbkumar.Jayanti@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/kumarjayanti/">
<![CDATA[<body>
A Question that is often asked is, I am&nbsp; Using&nbsp; a WSIT Secure
Scenario containing SAML Assertion, How do i access the SAML Assertion ?<br>
<br>
Here is how you can access the SAML Assertion inside your WebService
Endpoint Implementation Class. Note the method getSAMLAssertion() in
particular.<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
<code>package test;<br>
<br>
import com.sun.xml.wss.SubjectAccessor;<br>
import com.sun.xml.wss.XWSSecurityException;<br>
import com.sun.xml.wss.impl.XWSSecurityRuntimeException;<br>
import com.sun.xml.wss.saml.util.SAMLUtil;<br>
import java.util.Set;<br>
import javax.annotation.Resource;<br>
import javax.jws.WebMethod;<br>
import javax.jws.WebParam;<br>
import javax.jws.WebService;<br>
import javax.security.auth.Subject;<br>
import javax.xml.stream.XMLStreamException;<br>
import org.w3c.dom.Node;<br>
import javax.xml.stream.XMLStreamReader;<br>
import javax.xml.transform.Transformer;<br>
import javax.xml.transform.TransformerException;<br>
import javax.xml.transform.TransformerFactory;<br>
import javax.xml.transform.dom.DOMSource;<br>
import javax.xml.transform.stream.StreamResult;<br>
import javax.xml.ws.WebServiceContext;<br>
import org.w3c.dom.Element;<br>
<br>
@WebService()<br>
public class NewWebService {<br>
<br>
&nbsp;&nbsp;&nbsp; @Resource<br>
&nbsp;&nbsp;&nbsp; private WebServiceContext context;<br>
<br>
&nbsp;&nbsp;&nbsp; @WebMethod(operationName = "operation")<br>
&nbsp;&nbsp;&nbsp; public String operation(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@WebParam(name = "parameter") String parameter) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Hello "
+ parameter);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //get the Assertion from the
Context<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Element samlAssertion =
getSAMLAssertion(context);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //dump the assertion to
STDOUT<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
dumpDomNode(samlAssertion);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (
TransformerException ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("Error Dumping SAML Assertion");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return "Hello " + parameter;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; private static Element
getSAMLAssertion(WebServiceContext context) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Subject subj = SubjectAccessor.getRequesterSubject(context);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Set&lt;Object&gt; set = subj.getPublicCredentials();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Element samlAssertion = null;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for
(Object obj : set) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (obj instanceof XMLStreamReader) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XMLStreamReader reader = (XMLStreamReader) obj;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//To create a DOM Element representing the Assertion :<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
samlAssertion = SAMLUtil.createSAMLAssertion(reader);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return samlAssertion;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (XMLStreamException
ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//TODO:Add custom error handling logic<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
throw new XWSSecurityRuntimeException(ex);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch
(XWSSecurityException ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//TODO:Add custom error handling logic<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
throw new XWSSecurityRuntimeException(ex);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return null;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; private static void dumpDomNode(Node node) throws
TransformerException {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("====
DebugUtil.dumpDomNode(...) Start ====");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DOMSource domSource = new
DOMSource(node);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TransformerFactory tf =
TransformerFactory.newInstance();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Transformer xform = null;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xform = tf.newTransformer();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xform.transform(domSource,
new StreamResult(System.out));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("====
DebugUtil.dumpDomNode(...) End ====");<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
</code>
<hr style="width: 100%; height: 2px;"><br>
</body>]]>

</content>
</entry>
<entry>
<title>Securing Metro WebServices Using Kerberos Tokens</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/archive/2007/12/securing_metro.html" />
<modified>2007-12-06T16:12:14Z</modified>
<issued>2007-12-06T16:12:01Z</issued>
<id>tag:weblogs.java.net,2007:/blog/kumarjayanti/399.8771</id>
<created>2007-12-06T16:12:01Z</created>
<summary type="text/plain">Securing Metro WebServices Using Kerberos Tokens</summary>
<author>
<name>kumarjayanti</name>

<email>Vbkumar.Jayanti@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/kumarjayanti/">
<![CDATA[<body>
My Colleague Ashutosh has posted a nice blog on how to secure Metro
WebServices using Kerberos Tokens. <br>
<br>
<a
href="http://blogs.sun.com/ashutosh/entry/running_kerberos_token_profile_scenario">http://blogs.sun.com/ashutosh/entry/running_kerberos_token_profile_scenario</a><br>
<br>
Support for Kerberos Token Profile&nbsp; would be available in Metro
1.1 release (to be out soon).&nbsp; If you want to try it right away
then you can do so by downloading the latest nigtly&nbsp; <a
href="https://jax-ws.dev.java.net/servlets/ProjectDocumentList?folderID=5472&amp;expandFolder=5472&amp;folderID=5647">here</a>.<br>
<br>
The Metro Kerberos Implementation was tested&nbsp; for interoperability
with .NET implementation <a
href="http://blogs.sun.com/ashutosh/entry/web_services_interoprability_plugfest_and">last
month.</a><br>
</body>]]>

</content>
</entry>
<entry>
<title>SSL and CRL Checking with GlassFish V2</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/archive/2007/11/ssl_and_crl_che.html" />
<modified>2007-11-19T12:14:27Z</modified>
<issued>2007-11-19T12:14:22Z</issued>
<id>tag:weblogs.java.net,2007:/blog/kumarjayanti/399.8678</id>
<created>2007-11-19T12:14:22Z</created>
<summary type="text/plain">SSL and CRL Checking with GlassFish V2</summary>
<author>
<name>kumarjayanti</name>

<email>Vbkumar.Jayanti@Sun.COM</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/kumarjayanti/">
<![CDATA[<body>
<h1 style="margin-left: 160px;">SSL and CRL Checking with GlassFish V2</h1>
<h2>Introduction</h2>
This blog is dedicated to some of the
less documented but important aspects of using SSL on GlassFish V2. The
following topics would be covered :<br>
<br>
<ol>
<li><a href="#4">How to change the Keystore Password</a></li>
<li><a href="#5">Steps to develop a&nbsp; Skeletal&nbsp; Web
Application that uses
SSL Mutual Authentication </a><br>
</li>
<li><a href="#6">How to Enable CRL based Revocation Checking (Static
CRL file
approach)</a></li>
<li><a href="#7">How to Enable CRL based Revocation Checking (Dynamic
approach)</a></li>
<li><a href="#8">Revocation Checking using OCSP (Online Certificate
Status
Protocol)</a></li>
</ol>
<h2><a name="4"></a>How to change the Keystore Password</h2>
We should not change the GlassFish Keystore password directly using
Keytool, because if we did that then GlassFish would not know how to
retrieve the keys from it anymore. The reason why one would want to
change the keystore password is because the default&nbsp; password
"changeit" is not a secure password (everyone knows it).<br>
<br>
So what would happen if we change the keystore password directly using
the following command :<br>
<br>
&gt;keytool&nbsp; -storepasswd -keystore keystore.jks -new newpassword
-storepass changeit<br>
<br>
Now when you start GlassFish it wouldn't know what the new password is
so you would see the following exception<br>
<br>
Caused by: java.lang.IllegalStateException: Keystore was tampered with,
or password was incorrect<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.enterprise.security.SecuritySupportImpl.loadStores(SecuritySupportImpl.java:114)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.enterprise.security.SecuritySupportImpl.initJKS(SecuritySupportImpl.java:82)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.enterprise.security.SecuritySupportImpl.&lt;init&gt;(SecuritySupportImpl.java:76)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.enterprise.security.SecuritySupportImpl.&lt;init&gt;(SecuritySupportImpl.java:71)<br>
<br>
And GlassFish would Fail to start. So how does one change the Keystore
password for GlassFish. When we see the GlassFish Admin Console we see
the option to change the Administrator Password.<br>
<br>
&nbsp;Application Server --&gt; Administrator Password<br>
<br>
Changing this password also does not help, because it changes the
administrator password. So the real password to be changed is the
GlassFish Master Password.<br>
<br>
&gt;asadmin stop-domain<br>
<br>
Stop the domain if it is running,&nbsp; and then we can change the
master password.<br>
<br>
&gt;asadmin change-master-password --savemasterpassword=true<br>
Please enter the new master password&gt;<br>
Please enter the new master password again&gt;<br>
Master password changed for domain domain1<br>
<br>
Now let us see what happens if we try to list the GlassFish Keystore
using the old password<br>
<br>
&gt;keytool -list -keystore keystore.jks -storepass changeit<br>
keytool error: java.io.IOException: Keystore was tampered with, or
password was incorrect<br>
<br>
So we see that it fails, now let us try with the changed masterpassword<br>
<br>
&gt;keytool -list -keystore keystore.jks -storepass newpassword<br>
<br>
Keystore type: jks<br>
Keystore provider: SUN<br>
<br>
Your keystore contains 1 entries<br>
<br>
s1as, Nov 11, 2007, keyEntry,<br>
Certificate fingerprint (MD5):
C0:41:05:12:5A:77:E8:5D:1F:DB:FD:EF:E4:23:E2:42<br>
<br>
This confirms that the right way to change the keystore password is to
change the master password. Also do not forget the
--savemasterpassword=true option when changing the masterpassword if
you wish to save the changed masterpassword. Without this option the
masterpassword file if it exists will be deleted and hence you will be
prompted for the masterpassword every time you try to start the domain.
On the otherhand be aware that there is a risk associated in saving the master
passsword in a file<br>
<br>
<h3>Another Caveat When Changing Master Password <br>
</h3>
If you have added more keyentries into the GlassFish Keystore other
than the default "s1as" then when you change the master password, you
will have to manually change the KeyPassword of the KeyEntries that you
have added into the GlassFish Keystore. Otherwise&nbsp; GlassFish would
again fail to start and you may see the following exception :<br>
<br>
java.lang.reflect.InvocationTargetException<br>
...........<br>
<br>
Caused by: java.lang.IllegalStateException:
java.security.UnrecoverableKeyExcept<br>
ion: Cannot recover key<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.enterprise.security.SSLUtils.&lt;clinit&gt;(SSLUtils.java:128)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... 10 more<br>
Caused by: java.security.UnrecoverableKeyException: Cannot recover key<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.security.provider.KeyProtector.recover(KeyProtector.java:301)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:120<br>
)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
java.security.KeyStore.getKey(KeyStore.java:731)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.net.ssl.internal.ssl.SunX509KeyManagerImpl.&lt;init&gt;(SunX509KeyM<br>
anagerImpl.java:111)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$SunX509.engineInit<br>
<br>
Assuming my GlassFish Keystore had a KeyEntry "myserver" in addition to
"s1as" then upon changing the master password i would need to run the
following command to change the keypassword for "myserver" to be the
same as the new master password<br>
<br>
&gt;keytool -keypasswd -alias myserver -keystore keystore.jks
-storepass &lt;new master password&gt;<br>
<br>
This comes from the limitation of the&nbsp; JSSE API. The keypassword
and the keystore password cannot be different. The authentication
process will fail if the keystore and the certificate's private key
password are not the same.<br>
<br>
<h2><a name="5"></a>Steps to develop a&nbsp; Skeletal&nbsp; Web
Application that uses
SSL Mutual Authentication </h2>
Assuming you are all set with your correct Server Certificates in
place, here are the steps to create a Skeletal&nbsp; WebApplication
that makes use of SSL Mutual Authentication.&nbsp; I made of&nbsp;
NetBeans when developing the Application because it provides Visual
Editing of the Security Settings described in this section and makes
things very easy.<br>
<br>
The WebApplication demonstrated in this section would just have a
Welcome JSP and a&nbsp; Secure Hello.html page which&nbsp; is Secured
by specifying a Security Constraint requiring SSL Mutual
Authentication.&nbsp; You can access the complete WAR file for the
Application <a
href="http://weblogs.java.net/blog/kumarjayanti/archive/SSLMutualAuth.war">here</a>.<br>
<br>
<br>
So here is the simple&nbsp; Welcome JSP page.<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
&lt;%@page contentType="text/html"%&gt;<br>
......<br>
&nbsp;&nbsp; &lt;html&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;head&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;meta
http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;title&gt;JSP Page&lt;/title&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/head&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;body bgcolor="#FFFFFF"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Welcome to
the&nbsp; SSL Mutual Authentication Test Page<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br
/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;p&gt;Request a secure page &lt;a
href="secure/Hello.html"&gt;here!&lt;/a&gt;&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br
/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;p&gt;It will use SSL Mutual Authentication&lt;/p&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/body&gt;<br>
&nbsp;&nbsp; &lt;/html&gt;<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
In the web.xml we will add a Security Constraint for the URL&nbsp;
pattern "/secure/*"&nbsp; which is where our&nbsp; Secure Hello.html
page is located.&nbsp;&nbsp; We add a user-data-constraint with
transport-guarantee CONFIDENTIAL indicating the need to use SSL. Then
we add a&nbsp; login-config element with auth-method&nbsp; CLIENT-CERT
to indicate the need for Client Certificate Authentication (making it
an SSL Mutual Authentication Scenario).<br>
<br>
In addition we would need to define the role which will be allowed to
access the secure resources.&nbsp; Followed by a mapping of&nbsp; the
role to groups/principals in sun-web.xml.&nbsp; Here is how the
security portion of web.xml would look<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
&nbsp;&lt;security-constraint&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;display-name&gt;Constraint1&lt;/display-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;web-resource-collection&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;web-resource-name&gt;secure resource&lt;/web-resource-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;description/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;url-pattern&gt;/secure/*&lt;/url-pattern&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;GET&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;POST&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;HEAD&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;PUT&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;OPTIONS&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;TRACE&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;http-method&gt;DELETE&lt;/http-method&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/web-resource-collection&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;auth-constraint&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;description/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;role-name&gt;authorized&lt;/role-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/auth-constraint&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;user-data-constraint&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;description/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/user-data-constraint&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/security-constraint&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;login-config&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;auth-method&gt;CLIENT-CERT&lt;/auth-method&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/login-config&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;security-role&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;description/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;role-name&gt;authorized&lt;/role-name&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/security-role&gt;<br>
<hr style="width: 100%; height: 2px;">&nbsp;&nbsp; <br>
And here is how the role mapping in sun-web.xml is defined as <br>
<br>
&lt;security-role-mapping&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;role-name&gt;authorized&lt;/role-name&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;group-name&gt;authorized&lt;/group-name&gt;<br>
&nbsp;&lt;/security-role-mapping&gt;<br>
<br>
&nbsp;Now the last thing we would need to do is add the assign-groups
property for the Certificate Realm in Glassfish&nbsp; Domain.xml. This
would make sure that all Client's with Valid Client Certificates get
assigned a group named "authorized".&nbsp; Here is how the Cerificate
Realm configuration in GlassFish would look like<br>
<br>
<br>
&nbsp;&lt;auth-realm
classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm"
name="certificate"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property
name="assign-groups" value="authorized"/&gt;<br>
&nbsp;&lt;/auth-realm&gt;<br>
<br>
<h2><a name="6"></a>How to Enable CRL based Revocation Checking (Static
CRL file
approach)</h2>
Certificates may be revoked by a Certification Authority for Various
reasons.&nbsp; The most common proposed method for distributing
revocation information requires an issuing authority to publish a
signed list of revoked certificates (called CRL, acronym for
Certificate Revocation List). The reasons for revocation and a whole
lot of other details and issues with Revocation can be found elsewhere
on the world wide web. In this section of the&nbsp; blog we
will discuss how&nbsp; one can&nbsp; use such a&nbsp; CRL file to
enforce certificate revocation checking.&nbsp; <br>
<br>
Ofcourse a Static CRL file is no good because the revocation lists
issued by the Certificate Authority are bound to change overtime and so
any site/server depending on such a CRL file will need to deal with
issues of&nbsp; timely updates to the CRL file&nbsp; inorder to ensure
robust revocation information. A complete discussion of this topic is
out of the scope of this&nbsp; blog.<br>
<br>
The GlassFish&nbsp;&nbsp; http-listener element supports a Property
called "crlFile" whose value is a CRL file to be consulted during
SSL&nbsp; client Authentication. This can be an absolute or relative
file path. If relative it is resolved against the domain-dir. If the
property is not specified then CRL checking is disabled. <br>
<br>
For this blog&nbsp; i&nbsp; created a&nbsp; sample CA (Certificate
Authority) and&nbsp; generated a&nbsp; Client Certificate signed by the
CA. I later revoked the Client Certificate and the CA generated a
CRL(crl.pem)&nbsp; file containing the revocation information.&nbsp;
Here are the steps to simulate an SSL Client Authentication Failure
using the revoked certificate.<br>
<br>
1. Install the <a
href="http://weblogs.java.net/blog/kumarjayanti/archive/revoked.pfx">revoked
</a>ceritificate in your
Browser as the Client Certificate<br>
2. Copy the <a
href="http://weblogs.java.net/blog/kumarjayanti/archive/crl.pem">crl.pem</a>
file into
domains/domain1/config/ directory<br>
3. Specify the "crlFile" property in domain.xml under the http-listener
meant for SSL (port 8181)<br>
<br>
&lt;http-listener acceptor-threads="1" address="0.0.0.0"
blocking-enabled="false" default-virtual-server="server" enabled="true"
family="inet" id="http-listener-2" port="8181" security-enabled="true"
server-name="" xpowered-by="true"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ssl
cert-nickname="s1as" client-auth-enabled="false" ssl2-enabled="false"
ssl3-enabled="true" tls-enabled="true" tls-rollback-enabled="true"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;property
name="crlFile" value="${com.sun.aas.instanceRoot}/config/crl.pem"/&gt;<br>
&lt;/http-listener&gt;<br>
<br>
Notice that the Property should come below the ssl child element of
http-listener.<br>
<br>
&nbsp;4.&nbsp; Install the <a
href="http://weblogs.java.net/blog/kumarjayanti/archive/cacert.der">CA
certificate</a> in
GlassFish Truststore cacerts.jks using Keytool, or using NSS tools if
you are running in the enterprise profile.<br>
<br>
Now run the SSL Mutual Authentication Sample and you will see that the
Client Authentication Failed, the following Message can be seen in the
GlassFish server Logs :<br>
<br>
[#|2007-11-12T17:32:54.113+0530|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8181-0;|<br>
httpSSLWorkerThread-8181-0, fatal error: 46: General SSLEngine problem<br>
sun.security.validator.ValidatorException: PKIX path validation failed:
java.security.cert.CertPathValidatorException: Certificate has been
revoked, reason: unspecified|#]<br>
<br>
<h2><a name="7"></a>How to Enable CRL based Revocation Checking
(Dynamic approach)</h2>
In the previous section we discussed static CRL file approach to
revocation checking. But the JSSE supports Http URL based Revocation
Checking wherein the Revocation List will be dynamically downloaded
from the Ceritificate Authority.&nbsp; Since the SSL implementation in
GlassFish is essentially layered upon the JSSE support&nbsp; so this
feature of&nbsp; Dynamic CRL based revocation checking is supported by
GlassFish.&nbsp; The information about the revocation list URL&nbsp; is
encoded&nbsp; inside the Ceritificate&nbsp; itself as Extension
elements .&nbsp; For example i created a&nbsp; certificate using the
Verisign Test CA and the certificate it issued to me contains the
following extension elements :<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false<br>
AuthorityInfoAccess [<br>
&nbsp; [accessMethod: 1.3.6.1.5.5.7.48.1<br>
&nbsp;&nbsp; accessLocation: URIName: http://ocsp.verisign.com,
accessMethod: 1.3.6.1.5.5.7.48.2<br>
&nbsp;&nbsp; accessLocation: URIName:
http://SVRSecure-aia.verisign.com/SVRTrial2005-aia.cer]<br>
]<br>
#3: ObjectId: 1.3.6.1.5.5.7.1.12 Criticality=false<br>
#4: ObjectId: 2.5.29.31 Criticality=false<br>
CRLDistributionPoints [<br>
&nbsp; [DistributionPoint:<br>
&nbsp;&nbsp;&nbsp;&nbsp; [URIName: <a
href="http://SVRSecure-crl.verisign.com/SVRTrial2005.crl">http://SVRSecure-crl.verisign.com/SVRTrial2005.crl</a>]<br>
]]<br>
<hr style="width: 100%; height: 2px;"><br>
Notice the CRLDistributionPoints extension&nbsp; which specifies the
URL of the dynamicall downloadable CRL file from the CA.<br>
<br>
The tradeoff between a Static CRL File and a Dynamic CRL download would
be that a Dynamic CRL would be more&nbsp; robust and correct
but the size of the CRL file may impact the performance of the&nbsp;
revocation checking logic. <br>
<br>
In GlassFish the following two system properties (understood by the
underlying JSSE implementation)&nbsp; can be specified as jvm-options
in domain.xml to enable&nbsp; Dynamic CRL download based Revocation
Checking. <br>
<br>
&lt;jvm-options&gt;-Dcom.sun.net.ssl.checkRevocation=true&lt;/jvm-options&gt;<br>
&lt;jvm-options&gt;-Dcom.sun.security.enableCRLDP=true&lt;/jvm-options&gt;
<br>
<br>
This is because the way in which GlassFish uses the JSSE API's  causes these two options remain false by default.<br>
<br>
This approach ofcourse makes an assumption that the Certificate being
used contains a CRL DistributionPoint Extension element. Otherwise
enabling this option may cause failure.&nbsp; You may&nbsp; also&nbsp;
need to set the http.proxyHost and http.proxyPort&nbsp;
properties for this approach to work correctly. If for some reason the
CRL file could not be fetched from the specified URL at runtime you may
see an exception in the server logs of the following form :<br>
<br>
[#|2007-11-12T16:54:20.877+0530|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8181-1;|<br>
httpSSLWorkerThread-8181-1, fatal error: 46: General SSLEngine problem<br>
sun.security.validator.ValidatorException: PKIX path validation failed:
java.security.cert.CertPathValidatorException: revocation status check
failed: no CRL found|#]<br>
<br>
Make sure you do not mix the static approach mentioned in previous
section with this one, because although the static approach may work
even with certificates that do not contain a CRL DP extension, enabling
the dynamic CRL checking will cause failures if the Client certificate
does not contain a CRL DP Extension.<br>
<br>
To debug issues with CertPath API in JDK you can set the following JVM
Option in GlassFish domain.xml :&nbsp; -Djava.security.debug=certpath<br>
<br>
When the&nbsp; dynamic CRL checking succeeds you can see debug prints
of the following form after enabling certpath debugging using the above
option.<br>
<br>
<hr style="width: 100%; height: 2px;">certpath:
CrlRevocationChecker.verifyRevocationStatus() ---checking revocation
status...|#]
&nbsp;<br>
certpath: Checking CRLDPs for CN=ABC, OU=Terms of use at <a
class="moz-txt-link-abbreviated"
href="http://www.verisign.com/cps/testca">www.verisign.com/cps/testca</a>
(c)05, OU=Foo, O=BAR, L=BLR, ST=KN, C=IN|#]
&nbsp;<br>
certpath: Trying to fetch CRL from DP <a class="moz-txt-link-freetext"
href="http://svrsecure-crl.verisign.com/SVRTrial2005.crl">http://SVRSecure-crl.verisign.com/SVRTrial2005.crl</a>|#]
<br>
certpath: Downloading new CRL...|#]
<br>
certpath: Returning 1 CRLs|#]
<br>
certpath: CrlRevocationChecker.verifyRevocationStatus() crls.size() =
1|#]
&nbsp;<br>
certpath: starting the final sweep...|#]
<br>
certpath: CrlRevocationChecker.verifyRevocationStatus cert SN:
92665084177020392276407153602684386406|#]
&nbsp;<br>
certpath: -checker5 validation succeeded|#]
<br>
<br>
<hr style="width: 100%; height: 2px;"><br>
<br>
<h2><a name="8"></a>Revocation Checking Using OCSP</h2>
The <b>Online Certificate Status Protocol</b> (<b>OCSP</b>) is an
Internet protocol used for obtaining the
revocation status of an X.509 digital certificate. It is described
in <span class="external">RFC 2560</span> and is on the Internet
standards track. It was created
as an alternative to certificate revocation lists
(CRL), specifically addressing certain problems associated with using
CRLs in a public key infrastructure (PKI).
<br>
<br>
The JSSE in JDK 5 and Later releases supports OCSP based revocation
checking.&nbsp; The following link describes some of the PKI
Enhancements in Java SE 5<br>
<a
href="http://java.sun.com/j2se/1.5.0/docs/guide/security/pki-tiger.html">http://java.sun.com/j2se/1.5.0/docs/guide/security/pki-tiger.html</a>.<br>
<br>
To enable OCSP revocation Checking we need to set <tt>"ocsp.enable"
property </tt>to
true. This property may be set either statically in the Java runtime's
<tt>$JAVA_HOME/jre/lib/security/java.security</tt> file, or
dynamically using the <tt>java.security.Security.setProperty()</tt>
method.&nbsp; Incase of GlassFish the Static Approach of setting
inside&nbsp; java.security file is what would be possible.&nbsp;
This is because GlassFish does not set this property by default.<br>
<br>
The JSSE documentation indicates that one can possibly enable both OCSP
and Dynamic CRL DP approaches. It says,&nbsp; OCSP checking works in
conjunction with Certificate Revocation Lists (CRLs)
during revocation checking. Below is a summary of the interaction of
OCSP and CRLs. Failover to CRLs occurs only if an OCSP problem is
encountered. Failover does not occur if the OCSP responder confirms
either that the certificate has been revoked or that it has not been
revoked.<br>
<br>
<table nosave="" border="1" cellpadding="3" width="600">
<tbody>
<tr>
<th>PKIXParameters RevocationEnabled (default=true)</th>
<th><tt>ocsp.enabled</tt> (default=false)</th>
<th>Behavior</th>
</tr>
<tr>
<td>true</td>
<td>true</td>
<td>Revocation checking using OCSP,<br>
failover to using CRLs</td>
</tr>
<tr>
<td>true</td>
<td>false</td>
<td>Revocation checking using CRLs only</td>
</tr>
<tr>
<td>false</td>
<td>true</td>
<td>No revocation checking</td>
</tr>
<tr>
<td>false</td>
<td>false</td>
<td>No revocation checking</td>
</tr>
</tbody>
</table>
<br>
For revocation checking based on OCSP to work the certificate would
need to have the&nbsp;<span class="content"> URL of an online
certificate status protocol (OCSP)
server in the Authority
Info Access (AIA) extension of the certificate (as shown in the example
below)<br>
<br>
</span>
<hr style="width: 100%; height: 2px;"><span class="content"><br>
</span>#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false<br>
AuthorityInfoAccess [<br>
&nbsp; [accessMethod: 1.3.6.1.5.5.7.48.1<br>
&nbsp;&nbsp; accessLocation: URIName: http://ocsp.verisign.com,
accessMethod: 1.3.6.1.5.5.7.48.2<br>
&nbsp;&nbsp; accessLocation: URIName:
http://SVRSecure-aia.verisign.com/SVRTrial2005-aia.cer]<br>
]&nbsp;<br>
<hr style="width: 100%; height: 2px;"><br>
However the JSSE layer allows specifying a&nbsp; ocsp.responderURL
property.&nbsp; By default, the location of the OCSP responder is
determined implicitly from the certificate being validated. The
property is used when the Authority Information Access extension
(defined in RFC 3280) is absent from the certificate or when it
requires overriding.<br>
<br>
By enabling Certpath Debugging you should see the debugging info as
shown below when you set the ocsp.enable property to true.<br>
<br>
<hr style="width: 100%; height: 2px;">&nbsp;<br>
certpath: connecting to OCSP service at: <a
class="moz-txt-link-freetext" href="http://ocsp.verisign.com/">http://ocsp.verisign.com</a>|#]
<br>
certpath: OCSP response: Successful|#]
<br>
certpath: OCSP response type: basic|#]
<br>
certpath: OCSP Responder name: CN=VeriSign Trial Secure Server OCSP
Responder, OU=Terms of use at <a class="moz-txt-link-abbreviated"
href="http://www.verisign.com/cps/testca">www.verisign.com/cps/testca</a>
(c)05, OU="For Test Purposes Only.&nbsp; No assurances.", O="VeriSign,
Inc.", C=US|#]
<br>
certpath: Verified signature of OCSP Responder|#]
<br>
certpath: Status of certificate (with serial number
92665084177020392276407153602684386406) is: Good|#]
<br>
certpath: -checker5 validation succeeded|#]
<br>
certpath: checking for unresolvedCritExts|#]
<br>
certpath:
<br>
cert1 validation succeeded.
<br>
certpath: Cert path validation succeeded. (PKIX validation algorithm)|#]<br>
<br>
<hr style="width: 100%; height: 2px;"><a class="moz-txt-link-freetext"
href="http://java.sun.com/developer/EJTechTips/2006/tt0527.html"><br>
</a>
</body>]]>

</content>
</entry>
<entry>
<title>Addressing Version  Mismatch</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/archive/2007/10/addressing_vers.html" />
<modified>2007-10-22T11:41:47Z</modified>
<issued>2007-10-22T11:41:40Z</issued>
<id>tag:weblogs.java.net,2007:/blog/kumarjayanti/399.8429</id>
<created>2007-10-22T11:41:40Z</created>
<summary type="text/plain">An often asked question : WSE/WCF and WSIT use different versions of WS-Addressing (2004 vs. 2005).  Is there a way to change that behavior?</summary>
<author>
<name>kumarjayanti</name>

<email>Vbkumar.Jayanti@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/kumarjayanti/">
<![CDATA[<body>
<div class="Section1">
<p class="MsoNormal"><span
style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);"
lang="EN-US">A question on which i often have to search for the answer
since the number of different addressing related URL's floating around
are just too many...</span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, 125);"
lang="EN-US">&gt;The WSE SOAP message contains
xmlns:wsa=<a class="moz-txt-link-rfc2396E"
href="http://schemas.xmlsoap.org/ws/2004/08/addressing">"http://schemas.xmlsoap.org/ws/2004/08/addressing"</a>
and &lt;wsa:Action.../&gt; <br>
&gt;whereas the WSIT implementation searches for
a {<a class="moz-txt-link-freetext"
href="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing</a>}Action
header</span></p>
</div>
This should be easy to fix.&nbsp; In your NetBeans Project, You can open your&nbsp; wsit-*.xml
(inside
build/web/WEB-INF) of your WSIT service and then look for the assertion
:<br>
<br>
&lt;wsaws:UsingAddressing
xmlns:wsaws=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2006/05/addressing/wsdl">"http://www.w3.org/2006/05/addressing/wsdl"</a>/&gt;<br>
<br>
and change it to look as follows :<br>
<br>
&lt;wsaws:UsingAddressing
xmlns:wsaws=<a class="moz-txt-link-rfc2396E"
href="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy">"http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"</a>/&gt;<br>
<br>
build&nbsp; and deploy.&nbsp;
</body>]]>

</content>
</entry>
<entry>
<title>Metro 1.0 Security Overview and What&apos;s coming Next</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/archive/2007/09/metro_10_securi.html" />
<modified>2007-09-17T11:14:40Z</modified>
<issued>2007-09-17T11:14:20Z</issued>
<id>tag:weblogs.java.net,2007:/blog/kumarjayanti/399.8251</id>
<created>2007-09-17T11:14:20Z</created>
<summary type="text/plain">An Overview of WebServices Security in Metro 1.0 and New Features planned for upcoming Metro Milestone releases.</summary>
<author>
<name>kumarjayanti</name>

<email>Vbkumar.Jayanti@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/kumarjayanti/">
<![CDATA[<body>
<a href="https://metro.dev.java.net/discover/">Metro </a>is a
high-performance, extensible, easy-to-use web service stack.&nbsp; For
those of you who have heard about WSIT (WebServices Interoperability
Technology) or already using WSIT, Metro is Just a Renaming of the
Entire WebServices Stack from Sun. The 1.0 FCS Release of Metro is
going to be announced soon and so is the FCS release of &nbsp; <a
href="https://glassfish.dev.java.net/">GlassFish V2</a>.&nbsp;
GlassFish V2 Embeds the Metro 1.0 Stack within it thereby making
WebServices functionality directly usable from GlassFish (without the
need for any extra downloads or installations).<br>
<br>
The Metro Stack also carries over the original Goal of WSIT which is to
enable interoperability between the Java platform and Windows
Communication
Foundation (WCF).&nbsp; The Metro stack is also intended to be runnable
on other J2EE Containers as well as TOMCAT.&nbsp; Issues relating to
dependencies of&nbsp; a&nbsp; couple of Metro Components on Sun's JDK
will be sorted out very soon (<a
href="https://wsit.dev.java.net/issues/show_bug.cgi?id=687">see issue
687</a>)&nbsp; and this would be a big step towards making Metro a
Ubiquitous WebService's Stack. The WebServices Security implementation
in Metro is based on a Streaming Architecture thereby augmenting
the&nbsp; High Performance claims of Metro Stack .<br>
<br>
An overview of&nbsp; WebServices Security Support in Metro 1.0 and what
would be the new features in upcoming releases&nbsp; is what the rest
of this blog is dedicated to. <br>
<h3>Overview of&nbsp; WebServices Security Support in Metro 1.0</h3>
&nbsp;Security in Metro 1.0 is based on the following&nbsp; security
related Specifications and Standards :<br>
<br>
<ul>
<li><a
href="http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf">WS-Security
Core Specification 1.1</a></li>
<li><a
href="http://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os-UsernameTokenProfile.pdf">Username
Token Profile 1.1</a></li>
<li><a
href="http://www.oasis-open.org/committees/download.php/16785/wss-v1.1-spec-os-x509TokenProfile.pdf">X.509
Token Profile 1.1</a></li>
<a
href="http://www.oasis-open.org/committees/download.php/16785/wss-v1.1-spec-os-x509TokenProfile.pdf"></a><li><a
href="http://www.oasis-open.org/committees/download.php/16768/wss-v1.1-spec-os-SAMLTokenProfile.pdf">SAML
Token profile 1.1</a></li>
</ul>
The support for UsernameToken Profile 1.1 in Metro 1.0&nbsp; is partial
in the sense that&nbsp; Metro does not support Password Derived Keys.
The support for this is slated for a Near&nbsp; future Milestone&nbsp;
release of the Metro.&nbsp;&nbsp; The support for X.509 Token Profile
1.1 in Metro 1.0 is also Partial in the sense that&nbsp; Metro 1.0 only
supports the X509V3 Token Type. Some of the other token types such as
#PKCS7 and #X509PKIPathV1 are not supported in this release of Metro.<br>
<br>
The Security Requirements and Capabalities of a WebService in Metro are
expressed using WS-SecurityPolicy. The use of Security-Policy is a big
step towards achieving Interoperability between WebService Clients and
WebServices which can potentially be running on WebServices Stacks from
Different Vendors and Operating Systems and Containers. The underlying
Wire Interoperability is achieved by the use of &nbsp; WS-Security
standard, as well as a lot of other things such as WS-I,&nbsp; WS-I BSP
etc. <br>
<br>
The Version of the WS-SecurityPolicy specification draft that Metro 1.0
supports is the following :<br>
<br>
&nbsp;&nbsp; 1.<a
href="http://specs.xmlsoap.org/ws/2005/07/securitypolicy/ws-securitypolicy.pdf">
http://specs.xmlsoap.org/ws/2005/07/securitypolicy/ws-securitypolicy.pdf</a><br>
<br>
&nbsp;Support for the recently approved&nbsp; OASIS Standard version
of&nbsp; Security Policy&nbsp; <a class="moz-txt-link-freetext"
href="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.2/ws-securitypolicy.html">http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.2/ws-securitypolicy.html</a>&nbsp;
is under development and is slated for a future Milestone release of
Metro.&nbsp; <br>
<br>
&nbsp; The Programming Model when developing&nbsp; WebServices
Applications with Metro is the same old JAXWS Programming Model and
nothing new is required to be learned.&nbsp; <br>
<br>
Adding Security and other Quality of Service features to the&nbsp;
JAXWS Webservice is enabled Via Configuration. Part of the
configuration for Securing Access to the WebService is to specify
the&nbsp; Security-Policy of the WebService.&nbsp; While people can do
this manually by hand&nbsp; it can be a tedious and error prone
process. Moreover the set of&nbsp; possibilities of Security Policy
configuration for a WebService using the WS-SecurityPolicy
specification is just too huge and developers may get confused when
trying to map Abstract Security Requirements of their Applications into
a Policy Definition consisting of&nbsp; a few dozen policy
assertions.&nbsp; Metro provides a simpilification&nbsp; here by
defining a few set of&nbsp; important&nbsp; Security Scenarios
(sometimes called Security Profiles) and allows the developer to select
and Apply the Profile for&nbsp; his/her WebService.&nbsp;&nbsp; The
result of Applying a Security Profile to a WebService is that the
SecurityPolicy of the WebService is automatically generated.&nbsp;  The profiles also allow for some amount of configurability in terms of tokens to be used, whether or not to use SecureConversation Sessions, whether or not to derive new keys from existing ones for  multi-message exchanges, Which message parts to sign and/or encrypt etc. More
information on this can be accessed from the WSIT/Metro <a
href="https://wsit-docs.dev.java.net/releases/m6/index.html">Tutorial</a>
and Samples.&nbsp; Instructions on using NetBeans with GlassFish and
Metro are available <a
href="https://wsit-docs.dev.java.net/releases/m6/install.html">here</a>.<br>
<br>
&nbsp;The Token assertions in WS-Security Policy are abstract and need
to be bound to some real Tokens at runtime (such as a username/password
or an X509Certificate stored somewhere in a Keystore etc).&nbsp; To
facilitate this binding,&nbsp; Metro/WSIT defines a set of Proprietary
Policy Assertions applicable to the Client and Server side WebService
Configurations.&nbsp; Again the use of NetBeans&nbsp; and its WSIT
Plugin will ensure that the required configuration is easily specified
inside UI Screens.&nbsp; A set of <a
href="https://metro.dev.java.net/discover/screencasts.html">ScreenCasts</a>
are also available for users to get more familiarty with this
configuration process. The following article(s) details the complete
set of&nbsp; Proprietary configuration assertions supported by
Metro/WSIT Secuirty Module.<br>
<br>
&nbsp;&nbsp;&nbsp; 1. <a
href="https://xwss.dev.java.net/articles/security_config.html">https://xwss.dev.java.net/articles/security_config.html</a><br>
<br>
In the past Metro Security has been constantly tested for
Interoperability with&nbsp; Microsoft .NET (WCF) and&nbsp; Metro
Security will continue to evolve in this direction providing
first-class interoperabilty in future as well.<br>
<br>
<h3>What are the New Features being Planned in Metro Security&nbsp;
(Future Milestone Releases) ?</h3>
The <span style="font-weight: bold;">most important New Feature in
Metro Security to be released in the Near Future</span> is the support
for&nbsp; <a
href="http://www.oasis-open.org/committees/download.php/16788/wss-v1.1-spec-os-KerberosTokenProfile.pdf">OASIS
Kerberos Token Profile 1.1 </a>and ensuring that this feature
interoperates with Microsoft .Net&nbsp; WCF.&nbsp; Some of the other
features planned for future Milestone releases in the order of
importance are the following :<br>
<br>
<ol>
<li>Support for the recently approved&nbsp; OASIS Standard version
of&nbsp; Security Policy&nbsp; <a class="moz-txt-link-freetext"
href="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.2/ws-securitypolicy.html">http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.2/ws-securitypolicy.html</a>
<br>
</li>
<li>Support for Password Derived Keys</li>
<li>Support for&nbsp; Caching of Nonces and Replay Detection as
outlined in WSS specifications. This was supported in XWSS 2.0 but this
support in Metro was disabled due to a lack of Policy Assertion in the
Version of&nbsp; Security Policy currently being implemented by Metro
1.0</li>
<li>Support for Securing Attachments as defined by <a
href="http://www.oasis-open.org/committees/download.php/16672/wss-v1.1-spec-os-SwAProfile.pdf">WSS&nbsp;
SOAP With Attachements&nbsp; Profile 1.1.</a>This was supported in XWSS
2.0 but this support in Metro was disabled due to lack of&nbsp; a
Policy Assertion to express securing of Attachments. The latest
approved standard of&nbsp; WS-SecurityPolicy defines assertions to
express security (integrity and confidentiality) for Attachments.</li>
<li>Further Performance Optimizations in the Metro Streaming Security
Implementation.<br>
</li>
</ol>
New NetBeans profiles corresponding to the new features added will be available in the future releases.In addition Many other new  and interesting features are being planned in the Metro
WS-SecureConversation and WS-Trust Support and&nbsp; users are
requested to look out for blogs relating to them.<br>
<br>
A few other features which are currently being implemented (and will be
put out soon on the Main Trunk, downloadable from the latest Nightlies)
based on requests on the WSIT/Metro fourms from our users are as listed
below :<br>
<br>
<ol>
<li>&nbsp;Ensuring that the Bootrstrap Credentials during a
SecureConversation are available in the Requester Subject for&nbsp;
Application requests (This is already available on the Main Trunk)</li>
<li>Support for a Utility Class/Method to create a&nbsp; DOM
representation of&nbsp; SAMLAssertion given an Assertion as an
XMLStreamReader (This is already available on the Main Trunk)</li>
<li>Support for some kind of a Post Validation Hook for Tokens, that
would allow developers to do custom validation of Tokens. For example
checking a particular extension attribute in an X509 Certificate</li>
<li>Option&nbsp; to delegate Token Validation to a BackEnd System
(instead of Metro Stack doing it on itself). For example a particular
user has asked for a facility whereby the Signature of a Signed
SAMLAssertion can be verified by a backend system.</li>
<li>Ensuring that Programmatic Username/Password credentials&nbsp;
set on a Client Stub are passed on to the Embedded STS Client in case
of Scenarios using WS-Trust.<br>
</li>
</ol>
<br>
<br>
<br>
<br>
<br>
<br>
&nbsp;<br>
</body>]]>

</content>
</entry>
<entry>
<title>WSIT Security Configuration  demystified</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/kumarjayanti/archive/2007/04/wsit_security_c.html" />
<modified>2007-04-10T14:47:12Z</modified>
<issued>2007-04-10T14:47:06Z</issued>
<id>tag:weblogs.java.net,2007:/blog/kumarjayanti/399.7021</id>
<created>2007-04-10T14:47:06Z</created>
<summary type="text/plain">This is my first of multi-series blogs on WSIT Security Configuration</summary>
<author>
<name>kumarjayanti</name>

<email>Vbkumar.Jayanti@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/kumarjayanti/">
<![CDATA[Here is a link to an article that contains the first set of details on WSIT Security Configuration...<br>
<br>
<a href="https://xwss.dev.java.net/articles/security_config.html">WSIT
Security Configuration demystified</a><br>
<br>
I will be adding more details to it in the comings days and update
readers about it whenever that happens.<br>
<br>
Here are some of the other blogs of the team members working on WSIT
Security, Trust and SecureConversation that you might find
useful/related...<br>
<br>
<a href="http://blogs.sun.com/venu">http://blogs.sun.com/venu</a><br>
<a href="http://blogs.sun.com/shyamrao/">http://blogs.sun.com/shyamrao/</a><br>
<a href="http://blogs.sun.com/ashutosh/">http://blogs.sun.com/ashutosh/</a><br>
<a href="http://blogs.sun.com/harsha">http://blogs.sun.com/harsha</a><br>
<a href="http://blogs.sun.com/trustjdg">http://blogs.sun.com/trustjdg</a><br>
<a href="http://blogs.sun.com/manveen/">http://blogs.sun.com/manveen/</a>]]>

</content>
</entry>

</feed>