title: JwtTokenStore.findTokensByClientId(clientId) always return empty
body: <p>I am creating a spring-boot-oauth2 project and I'd like to revoke client's access token. Below is my configurations for Oauth2.</p>
  
  <pre><code>@Configuration
  @EnableAuthorizationServer
  public class OAuth2AuthorizationConfig extends AuthorizationServerConfigurerAdapter {
  
      @Autowired
      private AuthenticationManager authenticationManager;
  
      @Autowired
      private ClientDetailsService clientDetailsService;
  
      @Bean
      public JwtTokenStore tokenStore() {
          JwtTokenStore store = new JwtTokenStore(jwtAccessTokenConverter());
          return store;
      }
  
      @Bean
      public TokenEnhancerChain tokenEnhancerChain() {
          final TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
          tokenEnhancerChain.setTokenEnhancers(Arrays.asList(new CustomTokenEnhancer(), jwtAccessTokenConverter()));
          return tokenEnhancerChain;
      }
  
      @Bean
      @Primary
      public AuthorizationServerTokenServices tokenServices() {
          DefaultTokenServices tokenServices = new DefaultTokenServices();
          tokenServices.setTokenStore(tokenStore());
          tokenServices.setTokenEnhancer(tokenEnhancerChain());
          tokenServices.setClientDetailsService(clientDetailsService);
          tokenServices.setSupportRefreshToken(true);
          return tokenServices;
      }
  
      @Bean
      public JwtAccessTokenConverter jwtAccessTokenConverter() {
          JwtAccessTokenConverter converter = new CustomTokenEnhancer();
          KeyPair keyPair = new KeyStoreKeyFactory(new ClassPathResource("keystore.jks"), "secret".toCharArray()).getKeyPair("myapp-authkey");
          converter.setKeyPair(keyPair);
          return converter;
      }
  
      @Override
      public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
          // @formatter:off
          // register for backend application
          clients.inMemory()
            .withClient("myclient-backend")
            .secret("secret")
            .authorizedGrantTypes(
              "password","authorization_code", "refresh_token")
            .authorities("ROLE_TRUSTED_CLIENT")
            .scopes("read", "write", "update", "delete")
            .accessTokenValiditySeconds(1800) //Access token is only valid for 30 mins.
            .refreshTokenValiditySeconds(60 * 60 * 1) //Refresh token is only valid for 1 hour.
            .autoApprove(true)    
            ;     
       // @formatter:on
      }
  
      @Override
      public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
          // @formatter:off
              endpoints.tokenServices(tokenServices())
              .tokenStore(tokenStore())
              .authenticationManager(authenticationManager)
              .accessTokenConverter(jwtAccessTokenConverter());
           // @formatter:on
      }
  
      @Override
      public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
          // @formatter:off
          oauthServer.tokenKeyAccess("isAnonymous() || isRememberMe() || hasAuthority('ROLE_TRUSTED_CLIENT')")
              .checkTokenAccess("isAuthenticated() and hasAuthority('ROLE_TRUSTED_CLIENT')")
              .realm("mysecurityRealm");
           // @formatter:on
      }
  
  }
  </code></pre>
  
  <p>When I tried to fetch access tokens from tokenStore with clientId as below codes</p>
  
  <pre><code>@Autowired
  private JwtTokenStore tokenStore;
  @Autowired
  private ConsumerTokenServices consumerTokenServices;
  
  @RequestMapping(value = "/invalidateTokens", method = RequestMethod.POST)
  public @ResponseBody Map&lt;String, String&gt; revokeAccessToken(@RequestParam(name = "access_token") String accessToken) {
      logger.info("Invalidating access token ==&gt; " + accessToken);
      String clientId = "myclient-backend";
      List&lt;String&gt; tokenValues = new ArrayList&lt;String&gt;();
      Collection&lt;OAuth2AccessToken&gt; tokens = tokenStore.findTokensByClientId(clientId);
      logger.debug("Listing all active tokens for clientId '" + clientId + "'" + tokens);
      if (tokens != null) {
          for (OAuth2AccessToken token : tokens) {
              logger.info("==&gt; " + token.getValue());
              tokenValues.add(token.getValue());
          }
      }
      consumerTokenServices.revokeToken(accessToken);
  
      OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(accessToken);
      if (oAuth2AccessToken != null) {
          tokenStore.removeAccessToken(oAuth2AccessToken);
      }
      Map&lt;String, String&gt; ret = new HashMap&lt;&gt;();
      ret.put("removed_access_token", accessToken);
      return ret;
  }
  </code></pre>
  
  <p>It always output empty arrays as </p>
  
  <pre><code>Listing all active tokens for clientId 'myclient-backend'[]
  </code></pre>
  
  <p>What am I missing to configure ?</p>