Hello,
We are using JAAS with JBOSS for our web application. We want to display proper error message for different scenarios when access is denied, for example:
1) User ID or password is wrong
2) LDAP server is down, etc
But I don't know how to pass the proper error message from LoginModule to loginerror.jsp, there is something missing between loginModule and loginerror.jsp ( but I don't know what it is? With JAAS, it doesn't seem that we have a lot of control, all the page flow is controlled by web.xml)
Here is the login-config section for my web.xml
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login/login.jsp</form-login-page>
<form-error-page>/login/loginerror.jsp</form-error-page>
</form-login-config>
</login-config>
Here is the loginerror.jsp page:
<html>
<head>
<title>eQuation 2.0</title>
<link href="/styles/equation.css" rel="stylesheet">
</head>
<body>
<table width="850" border="0" cellspacing="0" cellpadding="1" bgcolor="DDDDDD" align="center">
<!-- Place header tag here -->
<jsp:include page="/common/header.jsp" />
<tr>
<td>
<TABLE width="100%" cellpadding="5" cellspacing="0" id="bodycontent">
<tr>
<td valign="top" width="80%">
<table bgcolor="DDDDDD" width="75%" align="center">
<tr>
<td>
<span class="parahead1">
Invalid username or password, please try again
</span>
</td>
</tr>
<tr>
<td>
<form action="j_security_check" method="post">
<table bgcolor="white" width="100%" cellpadding="3" cellspacing="3">
<tr>
<td id="smLabel">ONDex ID:</td>
<td id="dataText"><input type="text" name="j_username"></td>
</tr>
<tr>
<td id="smLabel">Password:</td>
<td id="dataText"><input type="password" name="j_password"></td>
</tr>
</table>
<br>
<center>
<input type="submit" value="Login">
<input type="reset">
</center>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- Place footer tag here -->
<jsp:include page="/common/footer.jsp" />
</table>
</body>
</html>
We have a customized loginModule class and its corresponding login-config.xml file. Here I don't know how to make the "Invalid username or password, please try again" a dynamic error message based on different scenarios happened in logModule, could some one give me some hints?
Thanks a lot and have a good night!!!
Jiao
-
How to display proper error message using JAAS with JBOSS (6 messages)
- Posted by: Jiao Yu
- Posted on: May 11 2006 23:22 EDT
Threaded Messages (6)
- Jboss Display proper error message by julie sokolowski on July 05 2006 09:18 EDT
- any one got a solution for this ? by Sukumar Sengottaiyan on January 02 2007 05:52 EST
- Re: How to display proper error message using JAAS with JBOSS by Srinivas Kairamkonda on July 13 2007 11:31 EDT
- How to display proper error message using JAAS with JBOSS by Vijay Parmar on February 25 2009 15:41 EST
- How to display proper error message using JAAS with JBOSS by Sharan Rajendran on March 05 2010 09:31 EST
- JBboss LdapLoginModule by Ram Kumar on March 23 2010 07:37 EDT
- How to display proper error message using JAAS with JBOSS by Sharan Rajendran on March 05 2010 09:31 EST
-
Jboss Display proper error message[ Go to top ]
- Posted by: julie sokolowski
- Posted on: July 05 2006 09:18 EDT
- in response to Jiao Yu
Jiao, I've been struggling with the same problem... did you happen to find a solution? Thanks, Julie -
any one got a solution for this ?[ Go to top ]
- Posted by: Sukumar Sengottaiyan
- Posted on: January 02 2007 05:52 EST
- in response to julie sokolowski
i wanted to know how to get the error message in the error.jsp, which we provide in the login module. also how do we know in the error.jsp, that the exception thrown is loginexception or credentialexception or passwordexpired exception ? -
Re: How to display proper error message using JAAS with JBOSS[ Go to top ]
- Posted by: Srinivas Kairamkonda
- Posted on: July 13 2007 11:31 EDT
- in response to Jiao Yu
Hello All, Has any body got a solution for this issue.If so, please.. please share with me. Many Thanks Srini -
How to display proper error message using JAAS with JBOSS[ Go to top ]
- Posted by: Vijay Parmar
- Posted on: February 25 2009 15:41 EST
- in response to Jiao Yu
The short answer is here http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3837765 HTH, Vijay -
How to display proper error message using JAAS with JBOSS[ Go to top ]
- Posted by: Sharan Rajendran
- Posted on: March 05 2010 09:31 EST
- in response to Vijay Parmar
One solution is... You can create a thread local variable and assign it from the LoginModule and access from your login jsp.. public static ThreadLocal loginException = new ThreadLocal(); public LoginExceptionsList() { loginException.set("Error from consutrctor"); } public static ThreadLocal getLoginExceptionText(){ return loginException; } public static void setLoginExceptionText(String msg){ loginException.set(msg); } -
JBboss LdapLoginModule[ Go to top ]
- Posted by: Ram Kumar
- Posted on: March 23 2010 19:37 EDT
- in response to Sharan Rajendran
Sharan,
I am using JBboss LdapLoginModule. How does your solution fit in this. Are you using your own login module?