title: Spring security how to allow anonymous access to most of site restricting certain actions
body: <p>I'd like to have a similar behavior to Stack Overflow where you can see most of the site anonymously and only requires a user role/authentication for certain actions.  Basically anonymous read with restricted writes. 
  What I was hoping I could do is specify anonymous access my security-config.xml and annotate various methods that require a proper user role.
  Config:</p>
  
  <pre><code>&lt;global-method-security secured-annotations="enabled" /&gt;
  
  &lt;http auto-config='true'&gt;
      &lt;intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /&gt;
      &lt;http-basic /&gt;
  &lt;/http&gt;
  </code></pre>
  
  <p>Method declaration</p>
  
  <pre><code>    @Secured("ROLE_USER")
      @RequestMapping(value = "/{estabID}", method = RequestMethod.GET)
      public ModelAndView getEstablishmentPage(@PathVariable String estabID) { .... }
  </code></pre>
  
  <p>However I am not prompted for the basic auth credentials with this configuration.  If I change the access attribute in the config to ROLE_USER everything works as expected, I'm presented with an auth challenge. </p>
  
  <p>What would be the best way to accomplish anonymous access by default with authenticated users for certain actions?</p>