Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

session scope/user authentication  RSS feed

 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. If you have a minute, I've been kinda messing around with user authentication and have a really basic question or whatever...

1. a login script assigns a value to a String object...based on values stored in a rdbms...for example, login as UserE and String object ACCESS="EDIT" is created/set and put into session...login as UserR and another String object ACCESS="READ" is created/set and put into session.

2. If the objects are stored in the session, does the client maintain it's link to it's own ACCESS String object until it is destroyed? (I presume the web.xml session-timeout setting would dictate when the destruction takes place).

I guess the major thing I want to make sure is that if UserR logs in and a String object is created and set to ACCESS="READ" and thrown into session, this value will not be overwritten when UserE logs in and creates/sets ACCESS="EDIT" and that is tossed into session.

Thank you very much for reading this.
[ December 21, 2004: Message edited by: Tom Griffith ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each user will get their own session so you do not have to worry about contention.
 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thank you for reading that. A level of uncertainty crept in reagarding that today...I've been developing an app on resin 3.0.8 using the above authentication. Pretty rudimentary. It seems like I keep losing either the reference to the String object or the value itself if the app remains idle for only a minute or so and then I hit a link to another jsp/javabean/servlet...or if I go to another website and hit the back button. I know this because I have an if statement that pulls up the login screen again if the session.getAttribute("ACCESS") equals null...and I keep getting the login screen after, again, staring into space and doing nothing for what seems like a minute and then hitting a link to another jsp/javabean/servlet...or...accessing another site like cnn, whatever, and hitting the back button. I checked the resin documentation and they say the default timeout is 30 minutes. I haven't deployed this to it's own war yet so I haven't customized a web.xml. Welp, thank you for reading again...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sound more like session difficulties rather than any kind of object contention. I'd look into if and why your sessions aren't being maintained. You have cookies enabled I assume?
 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. yeah, I just checked to make sure and cookies are enabled (IE 5.5). What was making me think it was a timeout thing is that if I keep "active" in the application and continue to perform various tasks (redirects to other jsp's, calling servlets and beans, etc), there is no problem with the object retention. The getAttribute and "if" statement to authenticate is located on every jsp. THe problem seems to be only if I let the app "sit" for like a minute...then I do something, and boom, back to the login...

but I see what you're saying, and I wouldn't have a clue where to even diagnose/rectify an internal session problem...
[ December 22, 2004: Message edited by: Tom Griffith ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!