title: Spring boot token authentication
body: <p>I trying to make login to Spring Boot application for another application  and generate token using Spring Security. What I try to achieve:</p>
  
  <ol>
  <li>Username and password are send to REST controller.</li>
  <li>If username and password is ok I want to generate token with 30 minutes expire time and send it back to user.</li>
  <li>Token is used to verify user in <code>@PreAuthorized</code> methods.</li>
  </ol>
  
  <p>Is the way to achive this in Spring Security or should I make it manually? I don't know how to save a token like Spring session using Spring Security.</p>