title: Spring logout access denied
body: <p>I'm using Spring Security, trying to set up basic login\logout functionality. Login works ok, I store users in MySQL DB, and I'm able to log in, but I have problem with logging out. On home page I made a logout link, looking like this, but when I click it I get 403 Access denied, and user doesn't get logged out:</p>
  
  <pre><code>&lt;a href="&lt;c:url value="j_spring_security_logout" /&gt;" &gt; Logout&lt;/a&gt;
  </code></pre>
  
  <p>And here is my security-context.xml:</p>
  
  <pre><code>&lt;security:authentication-manager&gt;
      &lt;security:authentication-provider&gt;
          &lt;security:jdbc-user-service data-source-ref="dataSource" /&gt;
      &lt;/security:authentication-provider&gt;
  &lt;/security:authentication-manager&gt;
  &lt;security:http use-expressions="true"&gt;
      &lt;security:intercept-url pattern="/static/**" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/loggedout" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/login" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/createoffer" access="isAuthenticated()" /&gt;
      &lt;security:intercept-url pattern="/docreate" access="isAuthenticated()" /&gt;
      &lt;security:intercept-url pattern="/offercreated" access="isAuthenticated()" /&gt;
      &lt;security:intercept-url pattern="/newaccount" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/createaccount" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/accountcreated" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/offers" access="permitAll" /&gt;
      &lt;security:intercept-url pattern="/**" access="denyAll" /&gt;
  
      &lt;security:logout logout-success-url="/loggedout"/&gt;
      &lt;security:form-login login-page="/login"
          authentication-failure-url="/login?error=true" /&gt;
  
  &lt;/security:http&gt;
  </code></pre>
  
  <p>And /loggedout is mapped to basic .jsp page, just saying "You have logged out."</p>
  
  <p>Also, when I click logout link when I'm not logged in, it takes me to the login page.</p>
  
  <p>What am I doing wrong?</p>