_011_Shiro_AuthenticationStrategy

• AuthenticationStrategy 接口的默认实现:
• FirstSuccessfulStrategy:只要有一个 Realm 验证成功即可,只返回第一个 Realm 身份验证成功的认证信息,其他的忽略;
• AtLeastOneSuccessfulStrategy:只要有一个Realm验证成功即可,和FirstSuccessfulStrategy 不同,将返回所有Realm身份验证成功的认证信息;
• AllSuccessfulStrategy:所有Realm验证成功才算成功,且返回所有Realm身份验证成功的认证信息,如果有一个失败就失败了。
• ModularRealmAuthenticator 默认是 AtLeastOneSuccessfulStrategy策略。

	<bean id="authenticator" 
             class="org.apache.shiro.authc.pam.ModularRealmAuthenticator">
		<property name="realms">
			<list>
				<ref bean="jdbcRealm" />
				<ref bean="secondShiroRealm" />
			</list>
		</property>
		
		<!-- Authentication -->
		<property name="authenticationStrategy">
			<bean class="org.apache.shiro.authc.pam.AllSuccessfulStrategy"></bean>
		</property>
	</bean>

猜你喜欢

转载自blog.csdn.net/poiuyppp/article/details/86596109
011