Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //import org.springframework.security.core.userdetails.User;
- String token = JWT.create()
- .withSubject(((User) authResult.getPrincipal()).getUsername())
- .withExpiresAt(new Date(System.currentTimeMillis()+ SecurityConstants.EXPIRED_TIME ))
- .sign(Algorithm.HMAC512(SecurityConstants.SECRET.getBytes()));
- response.addHeader(SecurityConstants.HEADER_STRING, SecurityConstants.TOKEN_PREFIX + token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement