title: How do I instantiate java.security.Principal? All the subclasses are deprecated
body: <p>I have a Spring API service which accepts Principal. </p>
  
  <pre><code>public ResponseEntity&lt;ApiCustomResponse&gt; create(Principal principal, UrlInfoData urlinfo) throws ApiException;
  </code></pre>
  
  <p>The Principal is created automatically by Spring for OAuth2 API calls. I would like to use the same service for the web page admin interface. </p>
  
  <pre><code>@Autowired
  private IShortUrlService apiService;
  ...
      Principal principal = new Principal();
      apiService.create(principal, urlinfo);
  </code></pre>
  
  <p>I want to instantiate the Principal with the current logged in admin user's name. However, all the instantiating classes are deprecated. How can I instantiate a Principal to pass to the service?</p>
  
  <p><a href="https://docs.oracle.com/javase/8/docs/api/java/security/Principal.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/docs/api/java/security/Principal.html</a></p>