Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

authentication  RSS feed

 
Rekha Pande
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

To do authentication, is there any other way other than passing request or session parameters.
I have this view.jsp file. I dont want any user to view this file untill and unless he has logged in from the login page. Now im authenticating my pages my passing session parameters between pages like this..
From process_login.jsp file
int valid=0;
when proper user
{
valid = 1;
}
session.setAttribute("valid",valid);

Is there any other way that i could do the authentication?
 
Ben Hur
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can protect a collection of resources by defining a security constraint:

http://www.theserverside.com/discussions/thread.tss?thread_id=31328
 
Hemanth Pallavajula
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

The solution provided works with Tomcat. But then, how to do authentication while using other web servers.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rekha Pande:
Now im authenticating my pages by passing session parameters between pages like this..
From process_login.jsp file
int valid=0;
when proper user
{
valid = 1;
}
session.setAttribute("valid",valid);


Why passing session parameter?

Just check that session attribute inside your servlet, probably, and if true forward to the desired page, otherwise forward to login page. isn't it simple?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!