Spring security - how to mention both form based and basic authentication

spring-security

Solution

The response by @grimesjm is right. However, if you are using Spring 3.x you have to adapt the class names to:

<bean id="basicProcessingFilter" class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
    <property name="authenticationManager">
        <ref bean="authenticationManager" />
    </property> 
    <property name="authenticationEntryPoint">
        <ref bean="authenticationEntryPoint" />
    </property>
</bean>

<bean id="authenticationEntryPoint"
    class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
    <property name="realmName" value="Your realm here" />
</bean>

And

<sec:http auto-config="true">
    ... your intercept-url here

    <sec:custom-filter before="SECURITY_CONTEXT_FILTER" ref="basicProcessingFilter" />

    <sec:form-login ... />
    ....
</sec:http>

I do not know whether placing the filter before `SECURITY_CONTEXT_FILTER` is the best option or not.

Problem

Is it possible to mention both form-based and basic authentication in Spring security using namespace configuration without overriding other ? So that the appliciation could serve both browser based request and remoting client.

Original source

Related problems