title: Spring Security - Custom authentication provider not called
body: <p>I have a Spring application (Spring version <strong>2.5.6.SEC01</strong>, Spring Security version <strong>2.0.5</strong>) with the following setup (this is based off of <a href="https://stackoverflow.com/questions/2010475/">this question</a>):</p>
  
  <p>In the <strong>security-config.xml</strong> file, I have the following configuration:</p>
  
  <pre><code>&lt;http&gt;
    &lt;!-- Restrict URLs based on role --&gt;
    &lt;intercept-url pattern="/WEB-INF/jsp/login.jsp*" access="ROLE_ANONYMOUS" /&gt;
    &lt;intercept-url pattern="/WEB-INF/jsp/header.jsp*" access="ROLE_ANONYMOUS" /&gt;
    &lt;intercept-url pattern="/WEB-INF/jsp/footer.jsp*" access="ROLE_ANONYMOUS" /&gt;
    &lt;intercept-url pattern="/login*" access="ROLE_ANONYMOUS" /&gt;
    &lt;intercept-url pattern="/index.jsp" access="ROLE_ANONYMOUS" /&gt;
    &lt;intercept-url pattern="/logoutSuccess*" access="ROLE_ANONYMOUS" /&gt;
  
    &lt;intercept-url pattern="/css/**" filters="none" /&gt;
    &lt;intercept-url pattern="/images/**" filters="none" /&gt;
    &lt;intercept-url pattern="/**" access="ROLE_ANONYMOUS" /&gt;
    &lt;anonymous /&gt;
    &lt;form-login login-page="/login.jsp"/&gt;
  &lt;/http&gt;
  
  &lt;beans:bean id="myUserDetailsService" class="com.example.login.MyUserDetailsService"&gt;
    &lt;beans:property name="dataSource" ref="dataSource" /&gt;
    &lt;custom-authentication-provider /&gt;
  &lt;/beans:bean&gt;
  
  &lt;authentication-provider user-service-ref="myUserDetailsService" /&gt;
  </code></pre>
  
  <p>The <strong>com.example.login.MyUserDetailsService</strong> class is defined:</p>
  
  <pre><code>public class MyUserDetailsService extends SimpleJdbcDaoSupport implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException,
            DataAccessException {
      logger.info("MyUserDetailsService.loadUserByUsername: Entered method. Username [" + userName + "]");
      ...
    }
  }
  </code></pre>
  
  <p>But I'm not seeing this log line.  How do I define a custom UserDetailsService so I can set the security roles?  I don't even need a custom service, but having this in the security-config.xml</p>
  
  <pre><code>&lt;authentication-provider&gt; &lt;jdbc-user-service data-source-ref="dataSource" /&gt;
  &lt;/authentication-provider&gt;
  </code></pre>
  
  <p>wasn't setting the role even though I have the users and authorities tables.  How can I set the Spring Security Roles?</p>