code: private void setUpTemporaryUserSubject() throws Exception {
          temporarySubject = new Subject();
          temporarySubject.getPrivateCredentials().add(recreatedToken);
          UserRegistry ur = getUserRegistry();
          String securityName = ur.getUserSecurityName(AccessIdUtil.getUniqueId(accessId));
          securityName = getSecurityName(securityName, securityName); // Special handling for LDAP under here.
          setWSPrincipal(temporarySubject, securityName, accessId, WSPrincipal.AUTH_METHOD_TOKEN);
          setCredentials(temporarySubject, securityName, null);
          setOtherPrincipals(temporarySubject, securityName, accessId, WSPrincipal.AUTH_METHOD_TOKEN, null);
      }
docs: Populate a temporary subject in response to a successful authentication.
  We use a temporary Subject because if something goes wrong in this flow,
  we are not updating the "live" Subject. If performance is a problem, it may
  be necessary to create a placeholder instead of a subject and modify the credentials
  service to return a set of credentials or update the holder in order to place in
  the shared state.
  
  @throws Exception