title: Spring Security generate access token programmatically
body: <p>I have a web application for generating <code>access_token</code> via client_id and secret in the Database.</p>
  
  <p>[Scenario]</p>
  
  <ol>
  <li><p>User01 - request a new token</p></li>
  <li><p>Service - get <code>client_id</code> then database which has status('Not Used')</p></li>
  <li><p>Service - generate token with selected <code>client_id</code> and <code>secret</code></p></li>
  </ol>
  
  <p>I want to generate token in service-layer.</p>
  
  <p>What I reference source code is <code>TokenEndpoint.postAccessToken()</code>. </p>
  
  <p>But, that source code needs the Principal object. I don't have that data. Because that object contains <code>User01</code> User's data. So that's not right data.</p>
  
  <p>How can I generate a token with client data in the Database?</p>