RealmAuthenticator is not a valid RealmAuthenticationProvide
sun-certified Apr 7, 2009 7:47 PMhi forum,
my system: jboss as 5.0.1, sun java 5, metro 3.1.0, net beans 6.5.1, windows xp
i built a jbossws webservice with netbeans 6.5.1. i'm using netbeans in order to leverage it's nifty point-and-click wsit configuration support.
i followed a combination of the jbossws instructions for configuring jbossws' metro wsit implementation, plus the more comprehensive instructions provided by sun for their original implementation of metro. i've been able to successfully configure jbossws for the ws-policy symmetric binding (server cert authn) authn mechanism. but that was done just as a proof of concept. my real requirement is to configure my web service for mutual certificate authentication.
using neatbeans 6.5.1 and glassfish v2.1, i am able to successfully configure mutual cert authn exactly as the instructions explain in the glassfish docs. unfortunately, it's nowhere near that easy when it comes to configuring jbossws's metro implementation. using netbeans as instructed in the glassfish docs does get me part of the way there. but something always goes wrong once the wsit-configured ws is deployed to jboss (for example, jaxb chokes on the
IncludeTimestamp element that netbeans includes by default in the wsit files it generates. as a shortcut, i figured: since i got mutual authn working in glassfish, i should be able to create a service with the same name as the one i have in jboss, configure that glassfish-deployed web service with the asymetric binding for mutual cert authn, then simply copy the netbeans-generated client and service wsit files to my jboss project. however, when i try to run the client against the service to test the mutual authn, i get this inexplicable exception ("Class :org.jboss.test.ws.jaxws.samples.wsse.RealmAuthenticator is not a valid RealmAuthenticationProvider");
as instructed by the jbossws metro docs that RealmAuthenticator class is referenced by a file named com.sun.xml.xwss.RealmAuthenticator which is located in the META-INF/services directory of the war file that is deployed for the web service. that file came from the jbossws metro 3.1.0 source distribution as part of the samples bundled with the distro.
the stack trace does seem to indicate that the wsit runtime has kicked in and it does appear as if it is at least attempting to authenticate the client's cert on the service side. but i am completely stumped as to why jboss's RealmAuthenticationAdapter has determined RealmAuthenticator isn't an instance of RealmAuthenticationAdapter (which it most definately is).
please, can anybody shed any light on what the problem might be?
thanks in advance for your help.
=============================================
/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.ws.jaxws.samples.wsse; import javax.security.auth.Subject; import com.sun.xml.wss.RealmAuthenticationAdapter; import com.sun.xml.wss.XWSSecurityException; /** * A simple realm authenticator showing how to override the WSIT default * (which is based on tomcat-users.xml when not running on Glassfish) * * @author alessio.soldano@jboss.com * @since 25-Apr-2008 * */ public class RealmAuthenticator extends RealmAuthenticationAdapter { @Override public boolean authenticate(Subject callerSubject, String username, String password) throws XWSSecurityException { System.out.println("Custom realm authenticator called: username=" + username + ", password=" + password); return (username.equals("kermit") && password.equals("thefrog")); } }
=============================================
... 2009-04-07 16:53:52,703 ERROR [com.sun.xml.wss.jaxws.impl] (HDScanner) WSSTUBE0027: Error in configuring Server Security Callback Handler. com.sun.xml.wss.impl.XWSSecurityRuntimeException: Class :org.jboss.test.ws.jaxws.samples.wsse.RealmAuthenticator is not a valid RealmAuthenticationProvider at com.sun.xml.wss.RealmAuthenticationAdapter.newInstance(RealmAuthenticationAdapter.java:109) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.getRealmAuthenticationAdapter(SecurityServerTube.java:767) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.configureServerHandler(SecurityServerTube.java:733) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.<init>(SecurityServerTube.java:150) at com.sun.xml.wss.provider.wsit.SecurityTubeAppender.appendTube(SecurityTubeAppender.java:129) at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$WsitTubelineAssembler.createServer(TubelineAssemblerFactoryImpl.java:101) at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:152) at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:217) at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467) at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parseAdapters(DeploymentDescriptorParserExt.java:295) at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parse(DeploymentDescriptorParserExt.java:171) at org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect.start(RuntimeModelDeploymentAspect.java:109) at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129) at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:75) at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) 2009-04-07 16:53:53,140 ERROR [com.sun.xml.wss.jaxws.impl] (HDScanner) WSSTUBE0028: Error in creating new instance of SecurityServerTube java.lang.RuntimeException: WSSTUBE0027: Error in configuring Server Security Callback Handler. at com.sun.xml.wss.jaxws.impl.SecurityServerTube.configureServerHandler(SecurityServerTube.java:739) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.<init>(SecurityServerTube.java:150) at com.sun.xml.wss.provider.wsit.SecurityTubeAppender.appendTube(SecurityTubeAppender.java:129) at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$WsitTubelineAssembler.createServer(TubelineAssemblerFactoryImpl.java:101) at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:152) at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:217) at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467) at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parseAdapters(DeploymentDescriptorParserExt.java:295) at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parse(DeploymentDescriptorParserExt.java:171) at org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect.start(RuntimeModelDeploymentAspect.java:109) at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129) at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:75) at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: com.sun.xml.wss.impl.XWSSecurityRuntimeException: Class :org.jboss.test.ws.jaxws.samples.wsse.RealmAuthenticator is not a valid RealmAuthenticationProvider at com.sun.xml.wss.RealmAuthenticationAdapter.newInstance(RealmAuthenticationAdapter.java:109) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.getRealmAuthenticationAdapter(SecurityServerTube.java:767) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.configureServerHandler(SecurityServerTube.java:733) ... 37 more 2009-04-07 16:53:53,140 DEBUG [org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl] (HDScanner) RuntimeModelDeploymentAspect:Destroy 2009-04-07 16:53:53,140 DEBUG [org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl] (HDScanner) RuntimeModelDeploymentAspect:Destroy 2009-04-07 16:53:53,140 DEBUG [org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerPostJSE] (HDScanner) Error during deploy: vfszip:/C:/development/jboss-5.0.1.GA/server/default/deploy/MutualCertTestApp.war/ javax.xml.ws.WebServiceException: Failed to build METRO runtime model at org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect.start(RuntimeModelDeploymentAspect.java:133) at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy(DeploymentAspectManagerImpl.java:129) at org.jboss.wsf.container.jboss50.deployer.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:75) at org.jboss.wsf.container.jboss50.deployer.AbstractWebServiceDeployer.internalDeploy(AbstractWebServiceDeployer.java:60) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.RuntimeException: WSSTUBE0028: Error in creating new instance of SecurityServerTube at com.sun.xml.wss.jaxws.impl.SecurityServerTube.<init>(SecurityServerTube.java:155) at com.sun.xml.wss.provider.wsit.SecurityTubeAppender.appendTube(SecurityTubeAppender.java:129) at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$WsitTubelineAssembler.createServer(TubelineAssemblerFactoryImpl.java:101) at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:152) at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:217) at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467) at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parseAdapters(DeploymentDescriptorParserExt.java:295) at org.jboss.wsf.stack.metro.DeploymentDescriptorParserExt.parse(DeploymentDescriptorParserExt.java:171) at org.jboss.wsf.stack.metro.metadata.RuntimeModelDeploymentAspect.start(RuntimeModelDeploymentAspect.java:109) ... 28 more Caused by: java.lang.RuntimeException: WSSTUBE0027: Error in configuring Server Security Callback Handler. at com.sun.xml.wss.jaxws.impl.SecurityServerTube.configureServerHandler(SecurityServerTube.java:739) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.<init>(SecurityServerTube.java:150) ... 36 more Caused by: com.sun.xml.wss.impl.XWSSecurityRuntimeException: Class :org.jboss.test.ws.jaxws.samples.wsse.RealmAuthenticator is not a valid RealmAuthenticationProvider at com.sun.xml.wss.RealmAuthenticationAdapter.newInstance(RealmAuthenticationAdapter.java:109) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.getRealmAuthenticationAdapter(SecurityServerTube.java:767) at com.sun.xml.wss.jaxws.impl.SecurityServerTube.configureServerHandler(SecurityServerTube.java:733) ... 37 more[/url]