aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes JDBCRealm and Form Login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JDBCRealm and Form Login" Watch "JDBCRealm and Form Login" New topic
Author

JDBCRealm and Form Login

Lars Zinkoff
Greenhorn

Joined: Jan 14, 2008
Posts: 2
I've been trying to get form-based login with jdbcRealm working, but I'm having a few problems.

Spent countless hours searching for an answer, but I can't find a solution.

First, I'll go through my configuration.

In the Glassfish Admin Console, I added a new realm under Configuration->Security->Realms:



The database connection is working, as I've been using it with the application before adding any login configuration.

I have the following table defined:





User contains: 'admin','76a2173be6393254e72ffa4d6df1030a'
Group contains: 'admin','Administrator'

The login page contains the following form:




Next, in web.xml:



And lastly, sun-web.xml:



Submitting my username/password on the login page results in a login failure, directing me to the login error page.



I found a blog post that suggested CHECKing " Default Principal To Role Mapping" under the Glassfish Security options:

http://gesker.blogspot.com/2007/03/jspwikiglassfish-install-part-11-of-18.html

In addition, I added the following to domain.xml (in order to get more detailed information):




The result was the following:



Any help would be appreciated.

[ January 14, 2008: Message edited by: Lars Zinkoff ]
[ January 14, 2008: Message edited by: Lars Zinkoff ]
feri guretno
Greenhorn

Joined: Jan 12, 2009
Posts: 7
Hi Zinkoff,

I also face exactly the same problem and exactly the same exception. I also have tried the login context , change to FINEST etc etc , but all of them doesn't work. Untill i found this forum and it seems that you have the same problems. btw, I use oracle for the database.

Someone tried to fill UTF-8 for the charset or change digest to "none" to use a clear text password but it doesn't work for me. See if it works in your code.

do you have already get the solution? Please help.



Guret
feri guretno
Greenhorn

Joined: Jan 12, 2009
Posts: 7
Allright!! I've got the solution.

if you use a cleartext password , set digest to "none". If it still doesn't work, try to change column name "password" in usertable to other name e.g "pwd". Sometimes column password is reserved by the database itself that prevent the jdbc realm to work properly.

Guret
Singireddy subbareddy
Greenhorn

Joined: Dec 24, 2009
Posts: 1
How to configure Glassfish with jdbc realm?
(i got this Error : SEC5046: Audit: Authentication refused for [admin].)

if you know please give me reply ssreddy86@gmail.com
 
Consider Paul's rocket mass heater.
 
subject: JDBCRealm and Form Login