Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 23rd, 2002, 09:59 AM
dodgie dodgie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: Northampton, England
Posts: 82 dodgie Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 12 h 3 m 13 sec
Reputation Power: 0
Simple JSP session question

Hi,

I am implementing a simple login system as part of a Java Server project. At present, I have a form which submits a username and password to a jsp files which then looks them up in the database and if correct allows the user to proceed.

I would like to use sessions to allow a logged in user to remain logged in from page to page.

I have read up on JSP sessions on the web, and I have some (limited) experience using sesssions with PHP.

Will it be sufficient (from a security point of view) to have my login jsp file use
PHP Code:
 session.setAttribute"loggedIn"true ); 

once the passowrd and username has been varified, and then to check loggedIn at the top of every subsequent page? Or is this open to misuse? In the tutorials I have seen on the web, I have seen very little mention of any security issues related to JSP sessions. Is it possible for a user to set loggedIn to be true from outside of the JSP? (i.e. from the URL line or anything?) thereby bypassing my log in page? If so, would it be better for me to set as session variables the username and password, and then do a check with the database at the top of every page?

Any help would be most appreciated.

Richard
__________________
Think of the most annoyingly simple question and I've probably asked it on here!

Reply With Quote
  #2  
Old January 23rd, 2002, 04:17 PM
wolfespawn wolfespawn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 68 wolfespawn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via AIM to wolfespawn
reply

i am assuming you are using tags?.. well, it sounds like everything you are saying is how we do ours....

the user should login with login and password, that pages goes to a page that does ALOT... should check to see if the user is legit (check for login&pw match).... and inside that logic, set JUST the login attribute to the session along with any other things you may want for the user (a namid or whatever)... do not set the password here because you dont want to hit the database on every page to check to see if the password& login match...

in a seperate if statement from the (if (request.getParamet("login") != null && --- password not null blah...)
outside of this if statement (which it will skip on the next page because password is null.... you have a if statement like

(session.getAttribute("login") != null)

then you can skip the body of the tag.. or code.. or whatever...

so... you first to see if there is a request object for your login & password (which will log the user in if they both exist and hit database) and if they are null, check to see if the user has a login session...

you must put the tag at the top of every JSP page which you wish the user to be logged in for in able to see... this is secure enough because if session is null, just redirect them to an error page or Session timed out page or even your login page... blah... hope this helps, i know i am rambling, i am just trying to remember my code...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Simple JSP session question

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap