zoukankan      html  css  js  c++  java
  • SPRING IN ACTION 第4版笔记-第九章Securing web applications-005-Applying LDAP-backed authentication

    一、

    1.This method is the  LDAP analog to  jdbcAuthentication() 

    1 @Override
    2 protected void configure(AuthenticationManagerBuilder auth)
    3 throws Exception {
    4     auth
    5         .ldapAuthentication()
    6         .userSearchFilter("(uid={0})")
    7         .groupSearchFilter("member={0}");
    8 }

    The userSearchFilter() and groupSearchFilter() methods are used to provide a filter for the base LDAP queries, which are used to search for users and groups. By default, the base queries for both users and groups are empty, indicating that the search will be done from the root of the LDAP hierarchy. But you can change that by specifying a query base:

     1 @Override
     2 protected void configure(AuthenticationManagerBuilder auth)
     3 throws Exception {
     4     auth
     5         .ldapAuthentication()
     6         .userSearchBase("ou=people")
     7         .userSearchFilter("(uid={0})")
     8         .groupSearchBase("ou=groups")
     9         .groupSearchFilter("member={0}");
    10 }

    The userSearchBase() method provides a base query for finding users. Likewise, the groupSearchBase() specifies the base query for finding groups. Rather than search from the root, this example specifies that users be searched for where the organization unit is people . And groups should be searched for where the organizational unit is groups .

  • 相关阅读:
    冒泡排序(可传函数参数)
    字符串转化成整数
    遍历文档内容,得到HTML层级结构
    跨域通信问题
    矩阵的快速幂
    CSS tricks
    牛客赛马网笔试攻略
    项目中遇到的问题
    Mysql远程链接访问权限设置
    恢复delete删除的数据
  • 原文地址:https://www.cnblogs.com/shamgod/p/5250165.html
Copyright © 2011-2022 走看看