Hi, all
I try to use PropertiesRealm, but I always got "invalid username or password" 
error.

The following is my shiro-users.properties and applicationContext-shiro.xml

===============shiro-users.properties============
user.root=root,administrator
user.jerry=jerry,manager,teller
user.jack=jack,contractor

====================applicationContext-shiro.xml===============
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:p="http://www.springframework.org/schema/p";
        xmlns:util="http://www.springframework.org/schema/util";

        xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-3.0.xsd";>

        <bean id="lifecycleBeanPostProcessor" 
class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>

        <bean id="shiroFilter" 
class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"
                p:securityManager-ref="securityManager"
                p:loginUrl="/login.html">
                <property name="filters">
            <util:map>
                <entry key="authc">
                    <bean 
class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter"/>
                </entry>
                        </util:map>
        </property>
                <property name="filterChainDefinitions">
                <value>
                /admin/** = authc, roles[admin]
                /teller/** = authc, roles[teller]
                /** = authc
                </value>
                </property>
        </bean>

        <bean id="securityManager" 
class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"
                p:realm-ref="propertiesRealm"/>

        <bean id="propertiesRealm" 
class="org.apache.shiro.realm.text.PropertiesRealm"/>

</beans>


Reply via email to