3

I'm developing a Grails REST API to use with an Angular app. I used Spring Security Rest Plugin for authentication.

I'm implementing a reset password feature, and after the user resets their password, I want to retrieve the JWT token, in order to send it to the Angular app, so the user will not need to authenticate manually.

How can I retrieve the token? Couldn't find it on the plugin docs. The commented line is what I want to achieve:

if(passwordReset?.isValid()){
   passwordReset.password = request.JSON.password
   User user = User.resetPassword(passwordReset)
   springSecurityService.reauthenticate(user.username)
   //springSecurityService.getJwtToken()            
}
Laurel
  • 5,965
  • 14
  • 31
  • 57
  • Maybe this link can help? http://www.baeldung.com/spring-security-registration-i-forgot-my-password. It's not for Grails/Angular but it should be easy to adapt. – FeinesFabi Dec 15 '16 at 22:10
  • @FeinesFabi Hi, just to be sure and not wasting time: The classes: Authentication, UsernamePasswordAuthenticationToken have no method for retrieving the spring security rest JWT token, which is what I need. The token to change the password is already working. Can I retrieve the jwt token from any of those classes? I'm asking because further in the article you have sent me, the user is redirected to the login page, indicating that the user will need to login manually, and because I couldn't find anything related to JWT token in the article. – Carlos Alberto Schneider Dec 28 '16 at 13:32

0 Answers0