Zonehy Zou
Zonehy Zou

Reputation: 5

spring security spring session,session not stored in spring session

I've Store some session attributes in spring-security UserDetailService#loadUserByUsername(), but it was not store in spring session, just response a new cookie which name is JSESSIONID. how to store it in spring session ? Is spring session filter execute after spring security filter?

Upvotes: 0

Views: 1477

Answers (1)

hong Yoon
hong Yoon

Reputation: 1

If you want to add more additional user information for spring boot environment after authentication using 'UserDetailsService' interface, create new class implementing 'AuthenticationSuccessHandler' interface, and add user information to Httpsession.

Spring session(of boot) only store user credential id except extra information, not like Spring(not of boot)

example link(not spring boot though..): https://javapointers.com/tutorial/spring-custom-authenticationsuccesshandler-example-2/

Upvotes: 0

Related Questions