Ok. Here was the original config I had used -
Code:
<http auto-config='true' path-type="regex">
<intercept-url pattern=".*" access="ROLE_USER" />
<form-login login-page="${login.page}" default-target-url="${login.default-target-url}" />
<logout logout-success-url="${logout.success-url}" />
<http-basic/>
</http>
So, what this does is, form-login takes precedence over the http-basic authentication. Whenever a simple request using say poster with auth parameters, is sent, it comes back with a login form.
I changed it to the following -
Code:
<beans:bean id="basicAuthenticationFilter"
class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
<beans:property name="authenticationManager" ref="authenticationManager"/>
<beans:property name="authenticationEntryPoint" ref="authenticationEntryPoint"/>
</beans:bean>
<beans:bean id="authenticationEntryPoint"
class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
<beans:property name="realmName" value="myApp"/>
</beans:bean>
....
....
<http auto-config='false' path-type="regex">
<intercept-url pattern=".*" access="ROLE_USER" />
<form-login login-page="${login.page}" default-target-url="${login.default-target-url}" />
<logout logout-success-url="${logout.success-url}" />
<http-basic/>
</http>
As far as I rememb, reading docs, the precedence of the above authenticationfilter was to be set above form-login. However, it seems that was for spring security 2.x. For 3.x it is automatically taken care of (?) !