Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tough authentication question?

 
THUAN VN
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends!
I design a jsp application and encounter a problem like this :
I have tables users(username, password) and Authentication_Type(Is_Web_Server)
The table users store username and password for the users
The column Is_Web_Server of table Authentication_Type stores the way user will login to the application.When users access the application, the system will read the Is_Web_Server column of Authentication_Type table : If Is_Web_Server is "N" the system shows a login.jsp and ask users to enter username and password, if Is_Web_Server is "Y" the web server will show a dialog to ask for username and password.
How to implement this stratery?
Could you pls provide any information or links that can help me?
Thanks in advenced
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
in this case you will acess the database any times, you could to store this information on session object.
Example:
<%
String isSystem = (String) session.getAttribute(Is_Web_Server);
if (isSystem.equals("Y"){ // has a valid login
// redirect to System page
} else if ( (isSystem.equals("N")) || isSystem == null) {
// redirect to login page
}
%>
Bye.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic