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 .

  • 相关阅读:
    深入理解link和@import到底有什么区别?
    你应该知道的简单易用的CSS技巧
    META标签的设置
    前端webp图片
    PAT 1130 Infix Expression[难][dfs]
    PAT 1118 Birds in Forest [一般]
    生信-cufflinks输入输出文件分析
    PAT 1121 Damn Single[简单]
    PAT 1049 Counting Ones [难]
    NGS中的一些软件功能介绍
  • 原文地址:https://www.cnblogs.com/shamgod/p/5250165.html
Copyright © 2011-2022 走看看