将Ldap XMLconfig从SpringMVC迁移到Java Config Spring Boot?

时间:2019-04-19 07:54:30

标签: spring spring-boot spring-mvc spring-security

我有一个使用Ldap从Ldap服务器获取用户角色的Spring Boot应用程序,但是我的管理员不知道如何在Spring Boot Java代码中创建Ldap配置文件,他给了我这个XML配置文件:

<beans:bean id="casAuthenticationProvider" class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
        <beans:property name="authenticationUserDetailsService">
          <beans:bean class="org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper">
            <beans:constructor-arg ref="userService" />
          </beans:bean>
        </beans:property>
        <beans:property name="serviceProperties" ref="serviceProperties"></beans:property>
        <beans:property name="ticketValidator">
            <beans:bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
                <beans:constructor-arg index="0" value="http://localhost:8080/cas"></beans:constructor-arg>
            </beans:bean>
        </beans:property>
        <beans:property name="key" value="cas"></beans:property>
    </beans:bean>

    <ldap-user-service id="userService"
        server-ref="ldapServer" 
        user-search-base="ou=People"
        user-search-filter="(uid={0})"
        group-search-base="ou=AM,ou=ROLES"
        group-role-attribute="cn"
        group-search-filter="(member={0})"
        role-prefix="ROLE_" />
    <ldap-server id="ldapServer" url="ldap://localhost:389/dc=maxcrc,dc=com" manager-dn="cn=admin,dc=maxcrc,dc=com" manager-password="123456"/>

我已经用谷歌搜索了我知道的每个关键词,但是找不到答案如何将这个XML配置转换为Java代码配置。怎么做?谢谢。

0 个答案:

没有答案