• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retrieving login information

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using Form Based Authentication (j_security_check, j_username, j_password) in my application. I am not sure how to retrieve the username/password after someone logs in. Could someone help me please..
Thanks!
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The idea is to encapsulate you away from the login logic boilerplate so you do not have to struggle with that in your servlet that are supposed to execute your application logic.
 
Meg Jolie
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much for your reply!

When the user logs in, I plan to retrieve that information and then make the username an attribute of the session. Other than this, I am not sure how the web server will associate the browser with its other requests? Is there any other better way to do this? Please help. Thanks!
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container tracks subsequent requests using sessions (or URL rewriting as a fallback) to determine whether or not a user has already logged on.

Since j_username and j_password are regular parameters, you are able to retrieve those in any servlet. The thing however is that you do not know which servlet will be invoked. based on your auth-constraints a whole set of servlets can be restricted and any request will result in the login page to show up. Your best bet is a filter.
 
Meg Jolie
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! I will try doing that..
 
I am a man of mystery. Mostly because of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic