title: example xml configuration of spring oauth 2
body: <p>I'm trying to implement add an oauth2 security scheme to my project,
  the oauth2 authentication server is already implemented by another project so all I need is to intercept relevant requests and use the the auth server in order to login,
  additionally, I want to use the auth server as an authorization provider by using the users' groups has roles in the application,
  my current spring security xml looks like this: </p>
  
  <pre><code>&lt;security:http pattern="/resources/**" security="none" /&gt;
      &lt;security:http pattern="/loginError.html" security="none" /&gt;
      &lt;security:http use-expressions="true"&gt;
          &lt;security:intercept-url pattern="/login.html"
                                  access="permitAll"/&gt;
          &lt;security:form-login login-page="/login.html"
                               authentication-failure-url="/loginError.html"/&gt;
          &lt;security:logout logout-success-url="/login.html"/&gt;
      &lt;/security:http&gt;
  
      &lt;security:authentication-manager&gt;
          &lt;security:authentication-provider&gt;
              &lt;security:user-service&gt;
                  &lt;security:user name="user" password="p" authorities="VIEW"/&gt;
                  &lt;security:user name="admin" password="p" authorities="ALL, VIEW"/&gt;
              &lt;/security:user-service&gt;
          &lt;/security:authentication-provider&gt;
      &lt;/security:authentication-manager&gt;
  
      &lt;security:global-method-security pre-post-annotations="enabled"/&gt;
  
      &lt;oauth:resource-server id="oauthResourceServer" entry-point-ref="entry"/&gt;
      &lt;bean id="entry" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"&gt;
          &lt;constructor-arg value="https://www.example.com" /&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>also, we're using a <code>web.xml</code> with this filter:</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
      &lt;filter-class&gt;
          org.springframework.web.filter.DelegatingFilterProxy
      &lt;/filter-class&gt;
  &lt;/filter&gt;
  </code></pre>
  
  <p>The current authentication-manager is going to get moved to a development profile, and of course is not expected to be used alongside the oauth server.
  I'm aware that it's probably best to move to spring 4 and have configuration in code like the examples but it is not possible for me at this time so the current configuration mechanism should be maintained</p>