I want to be able to authenticate users based on a username and password in a SQL server database. Presently, I have setup users by using the realmtool from the J2EE server. I would rather use the database entries. Could you please tell me how to do this? Can it be done from the deployment tool?
Surasak Leenapongpanit
Ranch Hand
Joined: May 10, 2002
Posts: 341
posted
0
In Security tab,choose Form Based authentication, instead of Basic authentication.
Karthik Guru
Ranch Hand
Joined: Mar 06, 2001
Posts: 1209
posted
0
Originally posted by surasak lee: In Security tab,choose Form Based authentication, instead of Basic authentication.
I have not used the j2ee server ( reference implementation). I had a question though. So it does allow me to specify the database as the repository against which it needs to authenticate with Form based authentication? I mean can i switch between LDAP, Database and flat file as possible repositories for form based authentication?
P.Jamieson
Greenhorn
Joined: Apr 30, 2003
Posts: 21
posted
0
If I set this for FORM-BASED authentication, what else do I need to do in order to authenticate to a SQL database? I need to authenticate to this database as I will be adding / deleting users (dynamic). [ November 20, 2003: Message edited by: P.Jamieson ]
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
5
posted
0
Take a look at this article on form-based security in J2EE web applications. Basically, you need three things: - a pair of HTML/JSP pages (login.jsp, login-error.jsp) - a restricted part of the web application (so that the container will force the user to login) - a security realm configured to use the database (vendor-specific)
Thanks, I have looked at this previously. The example that they use is for Tomcat users. I am using the J2EE web server (hence container). Looking at your points, could you please explain further how I can map a realm name to my database? Also do I have to edit any other files like they explain for Tomcat (i.e. server.xml)? I have already setup tables for users, user_roles and roles in my database.
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
5
posted
0
All I can say is read the J2EE tutorial. This page looked like the closest match for what you want to do. I haven't used the reference implementation in ages (and probably didn't specify any realms) so I'm really not able to help with specifics on that particular server.
P.Jamieson
Greenhorn
Joined: Apr 30, 2003
Posts: 21
posted
0
Thanks for your reply. I have gone through the tutorial and it only the basics. The only part that I need is to know how to create my own realm that is configured to use a database.
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
5
posted
0
In that case, go through your particular application server's documentation.