2 Replies Latest reply on Feb 11, 2004 4:04 AM by Andrew May

    Form Based Authentication Error

    Jason L. van Brackel Newbie

      I'm attempting to set up realm based security on JBoss 3.2.3. Here are snippets from my config files.

      WEB.XML
      <web-app>
      <security-constraint>
      <display-name>Secured</display-name>
      <web-resource-collection>
      <web-resource-name>LResource</web-resource-name>
      <url-pattern>/*</url-pattern>
      <http-method>GET</http-method>
      <http-method>POST</http-method>
      <http-method>PUT</http-method>
      <http-method>DELETE</http-method>
      </web-resource-collection>
      <auth-constraint>
      <role-name>parent</role-name>
      <role-name>admin</role-name>
      </auth-constraint>
      <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
      </security-constraint>

      <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>Authorized</realm-name>
      <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/failedLogin.html</form-error-page>
      </form-login-config>
      </login-config>....

      jboss-web.xml
      <jboss-web>
      <security-domain>java:/jaas/LWebSec</security-domain>
      </jboss-web>

      login-config.xml

      ...
      <application-policy name="LWebSec">
      <login-module code="org.jboss.security.auth.spi.DatabaseLoginModule" flag="required">
      <module-option name="dsJndiName">java:/PostgresDS</module-option>
      <module-option name="principalsQuery">select password from users username where username=?</module-option>
      <module-option name="rolesQuery">select roles, 'Roles' from UserRoles where username=?</module-option>
      </login-module>
      </application-policy>
      ....

      When I deploy my app and run jboss I get these error messages on startup

      10:36:18,690 ERROR [Digester] Parse Error at line 48 column 11: The content of element type "web-app" must match "(icon?,display-name?,description?,di
      tributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,ta
      lib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
      org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filte
      *,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-
      ef*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
      at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:362)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:296)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2959)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:918)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1145)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:988)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
      at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
      at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
      at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148)
      at org.apache.commons.digester.Digester.parse(Digester.java:1548)
      at org.jboss.web.tomcat.tc4.SingleSignOnContextConfig.applicationConfig(SingleSignOnContextConfig.java:299)
      at org.jboss.web.tomcat.tc4.SingleSignOnContextConfig.start(SingleSignOnContextConfig.java:741)
      at org.jboss.web.tomcat.tc4.SingleSignOnContextConfig.lifecycleEvent(SingleSignOnContextConfig.java:255)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3582)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
      at org.jboss.web.tomcat.tc4.EmbeddedTomcatService.createWebContext(EmbeddedTomcatService.java:549)
      at org.jboss.web.tomcat.tc4.EmbeddedTomcatService.performDeploy(EmbeddedTomcatService.java:309)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:428)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy4.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy5.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
      at org.jboss.Main.boot(Main.java:150)
      at org.jboss.Main$1.run(Main.java:395)
      at java.lang.Thread.run(Thread.java:534)
      10:36:18,752 INFO [Engine] SingleSignOnContextConfig[/LunchWeb]: WARNING: Security role name parent used in an <auth-constraint> without being define
      in a <security-role>
      10:36:18,752 INFO [Engine] SingleSignOnContextConfig[/LunchWeb]: WARNING: Security role name admin used in an <auth-constraint> without being defined
      in a <security-role>


      Please help I am pulling my hair out!

      Thanks in advance,

      Jason