Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. //import org.springframework.security.core.userdetails.User;
  2. String token = JWT.create()
  3. .withSubject(((User) authResult.getPrincipal()).getUsername())
  4. .withExpiresAt(new Date(System.currentTimeMillis()+ SecurityConstants.EXPIRED_TIME ))
  5. .sign(Algorithm.HMAC512(SecurityConstants.SECRET.getBytes()));
  6. response.addHeader(SecurityConstants.HEADER_STRING, SecurityConstants.TOKEN_PREFIX + token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement