0

how to get spring security session from zk controller ?

asked 2014-05-17 15:38:33 +0800

saadbouna gravatar image saadbouna
1

I am using spring security with ZK framework what i want to do is to have custom authentication ,in other word is to create a session that contain an id when authentication is succeeded and remove it when the user logout.so i wonder how to get this session from a ZK controller ?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-12-07 10:58:34 +0800

Darksu gravatar image Darksu
1991 1 4

Hello saadbouna,

Please refer to the following url's in order to get started with your task:

http://books.zkoss.org/index.php?title=SmallTalks/2013/March/IntegrateSpringSecuritywith_ZK

http://emrpms.blogspot.gr/2013/03/zk-spring-security-login-form.html

http://books.zkoss.org/wiki/ZKEssentials/Chapter8:_Authentication

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2014-12-07 11:33:24 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2014-12-07 11:38:04 +0800

This is all done by the spring-security self!

If it's well configurated the spring-security uses the users session that comes from the browser. The authentication is cleared immediatelly if you log out correctly.

SecurityContextHolder.clearContext();
Executions.sendRedirect("/j_spring_logout");

Otherwise it's cleared if the session is time out.

you can get at any place in the applications code the authentication object with this:

Authentication auth = SecurityContextHolder.getContext().getAuthentication();

best Stephan

PS: Have a look on ZKBoost. it's all in there.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-05-17 15:38:33 +0800

Seen: 56 times

Last updated: Dec 07 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More