Version 5

    FORM Authentication

     

    Form authentication inserts a HTML page into the flow of your application when a secured resource will be accessed. You configure the name of the form page and of the error page. If the authentication is successful the user will automatically be redirected to the original resource he is trying to access.

     

    There is a SecureAWebApplicationUsingACustomForm of how to set this up.

    web.xml

    <?xml version="1.0"?>
    <!DOCTYPE web-app PUBLIC
       "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
       "http://java.sun.com/dtd/web-app_2_3.dtd">
    
    <web-app>
       <description>The standard web descriptor for the jmx-console</description>
    
       <!-- A security constraint that restricts access to the HTML JMX console
       to users with the role JBossAdmin. Edit the roles to what you want and
       uncomment the WEB-INF/jboss-web.xml/security-domain element to enable
       secured access to the HTML JMX console.
       -->
       <security-constraint>
         <web-resource-collection>
           <web-resource-name>HtmlAdaptor</web-resource-name>
           <description>An example security config that only allows users with the
             role JBossAdmin to access the HTML JMX console web application
           </description>
           <url-pattern>/*</url-pattern>
         </web-resource-collection>
         <auth-constraint>
           <role-name>JBossAdmin</role-name>
         </auth-constraint>
       </security-constraint>
    
       <login-config>
          <auth-method>FORM</auth-method>
          <form-login-config>
             <form-login-page>/restricted/login.html</form-login-page>
             <form-error-page>/restricted/errors.jsp</form-error-page>
          </form-login-config>
       </login-config>
    
       <security-role>
          <role-name>JBossAdmin</role-name>
       </security-role>
    </web-app>