Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

[Spring] Obtain a session or request object

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
No problem, glad I could help.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic