You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by mlogemann <li...@logemann.org> on 2012/09/15 03:12:13 UTC

set authc.usernameParam via Spring

Hi,

how can i set these parameters via Spring config?

authc.usernameParam = somethingOtherThanUsername
authc.passwordParam = somethingOtherThanPassword
authc.rememberMeParam = somethingOtherThanRememberMe

I thought it must be somewhere in the ShiroFilterFactoryBean but how?

    <bean id="shiroFilter"
class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager"/>
        <property name="loginUrl" value="/s/TheLogin.app"/>
        <property name="successUrl" value="/s/goMain.app"/>
        <property name="unauthorizedUrl" value="/unauthorized.jsp"/>
        <property name="filterChainDefinitions">
            <value>
                # some example chain definitions:
                /res/** = anon
                /s/TheLogin.app = anon
                /** = authc
            </value>
        </property>
    </bean>




--
View this message in context: http://shiro-user.582556.n2.nabble.com/set-authc-usernameParam-via-Spring-tp7577799.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: set authc.usernameParam via Spring

Posted by Les Hazlewood <lh...@apache.org>.
You can just override the Filter instances in the 'filters' property and
set the properties on the new instances as desired:

<bean id="shiroFilter"
class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
    ...
    <property name="filters">
        <util:map>
            <entry key="authc">
                <bean
class="org.apache.shiro.web.filter.authc.FormAuthenticationFilter">
                    <property name="usernameParam"
value="somethingOtherThanUsername"/>
                    ...
                </bean>
            </entry>

        </util:map>
    </property
    ....
</bean>

HTH,

--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282
Stormpath wins GigaOM Structure Launchpad Award! http://bit.ly/MvZkMk


On Fri, Sep 14, 2012 at 6:12 PM, mlogemann <li...@logemann.org> wrote:

> Hi,
>
> how can i set these parameters via Spring config?
>
> authc.usernameParam = somethingOtherThanUsername
> authc.passwordParam = somethingOtherThanPassword
> authc.rememberMeParam = somethingOtherThanRememberMe
>
> I thought it must be somewhere in the ShiroFilterFactoryBean but how?
>
>     <bean id="shiroFilter"
> class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
>         <property name="securityManager" ref="securityManager"/>
>         <property name="loginUrl" value="/s/TheLogin.app"/>
>         <property name="successUrl" value="/s/goMain.app"/>
>         <property name="unauthorizedUrl" value="/unauthorized.jsp"/>
>         <property name="filterChainDefinitions">
>             <value>
>                 # some example chain definitions:
>                 /res/** = anon
>                 /s/TheLogin.app = anon
>                 /** = authc
>             </value>
>         </property>
>     </bean>
>
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/set-authc-usernameParam-via-Spring-tp7577799.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>