title: Spring Security - Redirect if already logged in
body: <p>I'm new to Spring: </p>
  
  <p>I do not want authenticated user from accessing the login page. What is the proper way to handle redirects for the '/login' if the user is already authenticated? Say, I want to redirect to '/index' if already logged in.</p>
  
  <p>I have tried 'isAnonomous()' on login, but it redirects to access denied page.</p>
  
  <pre><code>&lt;security:http auto-config="true" use-expressions="true" ...&gt;
      &lt;form-login login-processing-url="/resources/j_spring_security_check"
                   default-target-url="/index"
                  login-page="/login" authentication-failure-url="/login?login_error=t" /&gt;
      &lt;logout logout-url="/resources/j_spring_security_logout"  /&gt;
     ...
    &lt;security:intercept-url pattern="/login" access="permitAll" /&gt;
    &lt;security:intercept-url pattern="/**" access="isAuthenticated()" /&gt;
  &lt;/security:http&gt;
  </code></pre>