// Add anyRequest() last as a fall back. Spring Security would replace an existing anyRequest() matcher
// with this one, so to avoid that we only add it if the user hasn't configured anything.
http.authorizeRequests().anyRequest().authenticated();
}
// And set the default expression handler in case one isn't explicit elsewhere
http.authorizeRequests().expressionHandler(new OAuth2WebSecurityExpressionHandler());
ResourceServerSecurityConfigurer resources = new ResourceServerSecurityConfigurer();
http.apply(resources);
ResourceServerTokenServices services = resolveTokenServices();
if (services != null) {
resources.tokenServices(services);