users@glassfish.java.net

Pass username from custom realm to error page

From: <JasDA_at_web.de>
Date: Thu, 04 Jun 2009 11:31:02 +0200

Hi,

at the moment we are trying to get our old Tomcat 5 applications to work in Glassfish v2. I've implemented a custom realm for authentication and it works fine. But I have the following problem:
If a user enters a wrong password the user will be redirected to an error page:

  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>iods9Realm</realm-name>
    <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/loginError.do</form-error-page>
    </form-login-config>
  </login-config>

As you can see we're using Struts (I guess it's V1.x). My action looks like this:

    public void doExecute(ActionContext ctx) throws Exception
    {
        String text = "";
        if (ctx.request().getParameter("loginTimeout") != null)
        {
            .......
        }
        else
        {
            String userName = ctx.request().getParameter("j_username");
            .....
        }
        ctx.forwardByName("loginPage");
    }

In our tomcat environment all parameters (j_username, ...) were available in this action. Now in our glassfish environment the parameters map is empty so I can't get the username. Is there any chance to geht the username? Perhaps it is possible to access the request from my custom realm that extends the IASRealm?

Regards,
Jason
__________________________________________________________
WEB.DE FreeDSL mit DSL 6.000 Flatrate und Telefonanschluss
für 17,95 Euro/mtl.!* http://produkte.web.de/go/02/