• 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

[Spring] Obtain a session or request object

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am trying to add some authentication to my application.
I have a Request interceptor which checks for the existance of a user in the session, if its there it is ok, otherwise it redirects to the logon page.

When a user hist the logon page, the username and password field are valdiated using a validator to ensure there is a user name and password, this is then passed on to the logonControls doSubmitAction.

At this point I wish to authenticate the user and add it to the session.


Even using the onSubmitAction, I cant actual get either a session object or request object.

By this point I am guessing the request object is invalid anyway. But even from the applicationContext I seem to be unabel to find a method to return me a session.

Is it possible to chose which pages an interceptor will affect? I am thinking perhaps some pages will help with access levels/permissions.

Thanks
G
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What implementation of Controller are you using? SimpleFormController? If you are using SimpleFormController, then just override

 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jason,
Thanks, I feel very dumb. There are two SimpleFormControls listed in the API docs, one (the one I was reading) didnt have onSubmit.

Doh! one is the portlet versions!

Thank you for saving my from my own stupidity.

G
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem, glad I could help.
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic