This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Security and the fly likes authentication to support LDAP or database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "authentication to support LDAP or database" Watch "authentication to support LDAP or database" New topic

authentication to support LDAP or database

Srinivas Akshinthala

Joined: Mar 17, 2011
Posts: 4
I have a requirement that few users login through LDAP and few users are Login through database(Native),for this i developed Login page that username(j_username),password(j_password) and Login Type(type) fields.If iam select the Login type as LDAP and then press submit it is working fine,if i am select Login type as Database then press Submit it is first authenticated with LDAP and then it is going to database authentication irrespective of Login type as Native it is going to LDAP authentication.Please help me.
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2271

Howdy, Srinivas. Welcome to JavaRanch!

Champ, I'd kindly like to ask you to TellTheDetails. How's your environment? What's your server? Tomcat? How are you doing to switch between the types of authentication? How are your configuration files?

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Srinivas Akshinthala

Joined: Mar 17, 2011
Posts: 4
Hi Roberto
My Requirement is to authenticate the user either by using LDAP Or Native(Database),This is for when the LDAP Server is down the user can login through Native.(Some times the LDAP Server may be in down state).

My Environment is Struts,ApachedirectoryServer,Tomcat Server.

My Configuration in tomcat is:
In tomcat server.xml i replace the realm tag with the following code

I am attaching my Login jsp and My WebApplication Application web.xml
My Login jsp is:

My Application web.xml is:

Whenever Iam select LoginType as LDAP and click on Login button it is going to j_security_check of server(tomcat) it is fine but when we select LoginType as Native and Click On Login button then it is first going to j_security_check of server and then it is going to my / action irrespective of my selected Login Type.

Please help me.
I agree. Here's the link:
subject: authentication to support LDAP or database
It's not a secret anymore!