View Full Version : pass extra parameter through spring security authentication
ewawong
Apr 6th, 2010, 11:16 PM
Hi, guys
just tried out the spring security, i finished following the guide and everything works fine.
but i have a problem here, if inside the login page i have same extra parameter for example languague. and i would like to store the languague into session. do you guys have any idea on how to do it? i cant do it inside the login controller as, i got no control over that.............
thanks in advance.............
malarcon
Apr 7th, 2010, 08:16 PM
Well, haven't run into this yet, but here are my two cents, I think that implementing a HandlerInterceptor will do the trick.
Check here http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-handlermapping-interceptor
What I'd do is extend your interceptor with HandlerInterceptorAdapter (as the sample there) and override preHandle. There you can grab your parameter and process it as you business logic dictates.
ewawong
Apr 7th, 2010, 08:47 PM
Dear malarcon,
Thanks a lot for the your reply and suggestion, i'll try it out :)
malarcon
Apr 7th, 2010, 09:20 PM
wow, I'm afraid I pointed you into the wrong direction. Please take a look into this
http://webcache.googleusercontent.com/search?q=cache:vbsehel6TLYJ:www.codercorp.com/blog/spring/security-spring/custom-authenticationprocessingfilter-for-spring-security-to-perform-actions-on-login.html+AuthenticationProcessingFilter&cd=4&hl=en&ct=clnk&gl=us&client=firefox-a
But looks that filters have changed in spring-sec 3.0
http://static.springsource.org/spring-security/site/docs/3.0.x/reference/core-web-filters.html#ftn.d4e1461
Please accept my apologies if I pointed you into the wrong direction, hope this give you some more hints on how to solve it
Regards
ewawong
Apr 8th, 2010, 05:04 AM
hi malarcon,
it's ok, no problem :)
i just briefly went though the latest site suggest by you, it's information looks so useful and helpful.......... thank you once again :)
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.