简体   繁体   中英

How to get a Spring Security's token username on the client side from JSESSIONID cookie?

Is username that you specify while creating Springs's AuthenticationToken on the server in any way stored on the client side? Is it somehow stored in JSESSIONID cookie or in some other way or is it just a server-side entity that is just binded to container sessions? I want to retrieve username from JS script in my page to display username and etc... Is it possible to do it that way? Other alternatives?

Thx.

Take a look on SavedRequestAwareAuthenticationSuccessHandler, you can add a cookie on this method. You can see all the flow here http://docs.spring.io/spring-security/site/docs/3.0.x/reference/core-web-filters.html#form-login-flow-handling .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM