Sunday, 15 July 2012

java - @AuthenticationPrincipal doesn't show the authenticated user -



java - @AuthenticationPrincipal doesn't show the authenticated user -

i have next code, uses @authenticationprincipal find authenticated user

@requestmapping(value="/user/update",method=requestmethod.post) public @responsebody user edituser(@requestbody user newuser, @authenticationprincipal user user, httpservletresponse response) { system.out.println("authenticated user="+user); }

the problem is, when print out user's name, shows empty user, not 1 logged in. need differently create work?

after searching around, found this form page. directed me add together @enablewebmvcsecurity application. after adding that, works great!

java spring spring-security

No comments:

Post a Comment