Contrast: How to manually log out using spring security?
In my application, I have registered a new user screen, which is sent to the controller, which creates a new user in db (and makes some obvious checks). Then I want this new user to be automatically registered ... I'm kind of something like this:
SecurityContextHolder.getContext().setPrincipal(MyNewUser);
Edit Well, I'm almost implemented based on the answer to How to programmatically register a user using spring Security 3.1
Authentication auth = new UsernamePasswordAuthenticationToken(MyNewUser, null); SecurityContextHolder.getContext().setPrincipal(MyNewUser);
However, when deployed, jsp cannot access my MyNewUser.getWhateverMethods() , whereas with the normal login procedure. code that works normally but generates an error during registration, as described above:
<sec:authentication property="principal.firstname" />
spring-mvc spring-security
NimChimpsky Oct 26 '11 at 9:40 2011-10-26 09:40
source share