@Override
 public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
   oauthServer
       .tokenKeyAccess("isAnonymous() || hasAuthority('" + AuthoritiesConstants.USER + "')")
       .checkTokenAccess("hasAuthority('" + AuthoritiesConstants.USER + "')");
 }
 @Override
 public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
   oauthServer.tokenKeyAccess("permitAll()").checkTokenAccess("isAuthenticated()");
 }