Spring Security 学习系列(5) - Spring Security 配置 4

再讲讲标签<authentication-manager>

该标签管理安全验证方案。 且看该标签的子标签  <authentication-provider>, 它的验证方案有三种:

1. user-service : 通过配置的用户名密码的方式实现安全验证。

2. jdbc-user-service: 通过数据库里面的用户名密码的方式实现方案验证。

3.ldap-user-service:通过ldap的方式验证用户名密码实现安全验证。 

<authentication-provider>标签下还需要密码encode方案, <password-encoder>

总结下来, 一个简单的<authentication-manager>配置就是如下方案:

    <authentication-manager>
        <authentication-provider>
            <password-encoder ref="encoder"/>
            <user-service>
                <user name="administrator" password="07a130111f1f911148fc3fa252add84a89fefb39fa4559648a08543f1b79cfbd74dfa6a05e389fc5" authorities="supervisor, user, teller" />
                <user name="operator" password="270bbd890ad86ad4847a49c3b0058ccc3c4c9cfee31446b3cf032c0d4d15354b36473c0f063c6ce7" authorities="user" />
            </user-service>
        </authentication-provider>
    </authentication-manager>

猜你喜欢

转载自startfromheart.iteye.com/blog/1683335