title: Spring Security getPrincipal() method returns anonymousUser
body: <p>in my spring web application I want to get an authenticated user in my controller:</p>
  
  <pre><code>Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
  </code></pre>
  
  <p>But the principal's value is "anonymousUser" although I have loged in.
  How can I get an authenticated user?
  My configurations in spring-security.xml:</p>
  
  <pre><code>&lt;http auto-config="true" request-matcher="regex"&gt;
      &lt;intercept-url pattern="/welcome*" access="ROLE_USER" /&gt;
      &lt;form-login login-page="/login" default-target-url="/welcome"
          authentication-failure-url="/loginfailed" /&gt;
      &lt;logout logout-success-url="/logout" /&gt;
  &lt;/http&gt;
  </code></pre>