title: Configuring Spring OAuth2 expression handler methods for authorization server endpoints using java config
body: <p>In our app we would like to lock down the check_token endpoint so that only clients authenticated using client credentials can check the validity of tokens.</p>
  
  <p>The documentation states that an expression handler is enabled by default when <code>@EnableResourceServer</code> is used, and has some instructions on how to set expression handling up using xml.
  What do I need to do do have spring the evaluate the expression below using java config?</p>
  
  <pre><code>@Configuration
  @EnableAuthorizationServer
  public class OAuth2AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
  
      ...
  
      @Override
      public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
          security.checkTokenAccess("#oauth2.isClient()");
      }
  
      ...
  }
  </code></pre>