title: getPrincipal() method returns anonymous user
body: <p>I'm trying to get the connected user via spring security method </p>
  
  <pre><code>public static User getConnectedUser() {
      Authentication auth = SecurityContextHolder.getContext().getAuthentication();
      User currentUser=auth.getPrincipal();
  }
  </code></pre>
  
  <p>When i invoke this method from a webservice get method using postman it returns anonymousUser even if am logged in.
  Here is my spring security configuration:</p>
  
  <pre><code>&lt;http auto-config="true" use-expressions="true"&gt;
      &lt;intercept-url pattern="/app/admin/**" access="hasRole('ROLE_ADMIN')"/&gt;
      &lt;intercept-url pattern="/app/passwordHint*" access="hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_ANONYMOUS')"/&gt;
      &lt;intercept-url pattern="/app/requestRecoveryToken*" access="hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_ANONYMOUS')" /&gt;
      &lt;intercept-url pattern="/app/updatePassword*" access="hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_ANONYMOUS')" /&gt;
      &lt;intercept-url pattern="/app/signup*" access="hasAnyRole('ROLE_USER','ROLE_ADMIN','ROLE_ANONYMOUS')"/&gt;
      &lt;intercept-url pattern="/app/**" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')"/&gt;
      &lt;form-login login-page="/login" authentication-failure-url="/login?error=true" login-processing-url="/j_security_check"/&gt;
      &lt;remember-me user-service-ref="userDao" key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/&gt;
      &lt;custom-filter ref="ajaxTimeoutRedirectFilter" after="EXCEPTION_TRANSLATION_FILTER"/&gt;
  &lt;/http&gt;
  </code></pre>
  
  <p>Even when i added this line <code>&lt;intercept-url pattern="/*" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')"/&gt;</code> to the above configuration it returns the anonymousUser.</p>
  
  <p>Here is the url i request from postman.</p>
  
  <pre><code>http://localhost:8080/myApp/services/api/seal/
  </code></pre>