<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Problem implementing WS-Security X509 Token in JBoss 5.x
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/soulshunter">Andrea De Angelis</a> in <i>JBoss Web Services</i> - <a href="https://community.jboss.org/message/771678#771678">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi all,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> i'm re-writing an application developped for JBoss 4.3 fro a new environment in JBoss 5.1.</p><p>In this application (EAR) we've a WAR with some Web Services with WS-Security and X509 Token.</p><p>In the first environment (Jboss 4.3) my jboss-wsse-server.xml look as:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>{code:xml}</p><p><jboss-ws-security</p><p><span>   xmlns="</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/config" target="_blank">http://www.jboss.com/ws-security/config</a><span>"</span></p><p><span>   xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"</span></p><p><span>   xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/config" target="_blank">http://www.jboss.com/ws-security/config</a></p><p><span>                                                     </span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd" target="_blank">http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd</a><span>"></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>           <!-- PRODUCTION    --></p><p>    <key-store-file><span style="color: #ff0000;">/mydirectory/keystore/server.keystore</span></key-store-file></p><p>    <key-store-password>xxx</key-store-password></p><p>    <key-store-type>jks</key-store-type></p><p>    <trust-store-file><span style="color: #ff0000;">/mydirectory/keystore/server.truststore</span></trust-store-file></p><p>    <trust-store-password>xxx</trust-store-password></p><p>    <trust-store-type>jks</trust-store-type></p><p>        </p><p>    <!-- timestamp tolerance --></p><p>    <timestamp-verification createdTolerance="600" warnCreated="true" expiresTolerance="600" warnExpires="true" /></p><p>    </p><p>    <config></p><p>        <!-- <timestamp ttl="1000"/>  --></p><p>        <sign type="x509v3" alias="server" /></p><p>        </p><p>        <requires></p><p>            <signature/></p><p>        </requires></p><p>        <authenticate></p><p>            <signatureCertAuth certificatePrincipal="com.examples.service.jbossws.MyCertificatePrincipal"/></p><p>        </authenticate></p><p>    </config></p><p></jboss-ws-security></p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And my Jboss-service.xml as:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>{code:xml}</p><p><mbean code="org.jboss.security.plugins.JaasSecurityDomain"</p><p>       name="jboss.security:service=SanferSecurityDomain"></p><p>    <constructor></p><p>     <arg type="java.lang.String" value="SanferWSCert"/></p><p>    </constructor></p><p>    <attribute name="KeyStoreURL"><span style="color: #ff0000;">/mydirectory/keystore/server.keystore</span></attribute></p><p>    <attribute name="KeyStorePass">xxx</attribute></p><p>    <attribute name="KeyStoreType">jks</attribute></p><p>    <depends>jboss.security:service=JaasSecurityManager</depends></p><p>  </mbean></p><p>  </p><p>  <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"</p><p>    name="whatever:service=SanferLogin"></p><p>    <attribute name="AuthConfig">my-login-config.xml</attribute></p><p>    <depends optional-attribute-name="LoginConfigService"></p><p>      jboss.security:service=XMLLoginConfig</depends></p><p>    <depends optional-attribute-name="SecurityManagerService"></p><p>      jboss.security:service=JaasSecurityManager</depends></p><p>  </mbean></p><p></server></p><p>{code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I highlighted in red the absolute path of my keystore and truststore.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When i deploy this EAR in Jboss 4.3 everything it's ok, but in Jboss 5.1 i've the error message above:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>{code}</p><p>Caused by: org.jboss.ws.WSException: Cannot find required security resource: /opt/sanfer/keystore/server.keystore</p><p>          at org.jboss.ws.metadata.wsse.WSSecurityConfigFactory.getResource(WSSecurityConfigFactory.java:114)</p><p>          at org.jboss.ws.metadata.wsse.WSSecurityConfigFactory.initKeystorePath(WSSecurityConfigFactory.java:89)</p><p>          at org.jboss.ws.metadata.wsse.WSSecurityConfigFactory.createConfiguration(WSSecurityConfigFactory.java:72)</p><p>          at org.jboss.ws.metadata.builder.jaxws.JAXWSWebServiceMetaDataBuilder.buildWebServiceMetaData(JAXWSWebServiceMetaDataBuilder.java:132)</p><p>          at org.jboss.ws.metadata.builder.jaxws.JAXWSServerMetaDataBuilder.setupProviderOrWebService(JAXWSServerMetaDataBuilder.java:52)</p><p>          at org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilderJSE.buildMetaData(JAXWSMetaDataBuilderJSE.java:61)</p><p>          at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.start(UnifiedMetaDataDeploymentAspect.java:64)</p><p>          at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129)</p><p>          at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:76)</p><p>          at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60)</p><p>          at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)</p><p>          at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)</p><p>          ... 30 more</p><p>{code}</p><p>The WSSecurityConfig can't locate the keystore from the absolute path, but the JaasSecurityDomain however locate it.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I've tried another different way putting the Keystore and Trustore inside the WEB-INF folder of WAR, and i've a similar scenario.</p><p>In this case the WSSecurityConfig locate the Kesytsore/Trustore but the JaasSecurityDomain throw the error "Can't locate resource: WEB-INF/server.keystore".</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I think i've some Class Loading issue, can you help me to fix it?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks for the help.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/771678#771678">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>