573.224ada77.js 14.1 KB
Newer Older
茶陵後's avatar
茶陵後 已提交
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[573],{1002:function(e,r,t){"use strict";t.r(r);var a=t(56),v=Object(a.a)({},(function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[t("h1",{attrs:{id:"ldap-命名空间选项"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-命名空间选项"}},[e._v("#")]),e._v(" LDAP 命名空间选项")]),e._v(" "),t("p",[e._v("LDAP 实现广泛地使用 Spring LDAP,因此熟悉该项目的 API 可能是有用的。")]),e._v(" "),t("h2",{attrs:{id:"使用以下命令定义-ldap-服务器"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#使用以下命令定义-ldap-服务器"}},[e._v("#")]),e._v(" 使用以下命令定义 LDAP 服务器")]),e._v(" "),t("p",[t("code",[e._v("<ldap-server>")]),e._v("元素此元素设置一个 Spring LDAP"),t("code",[e._v("ContextSource")]),e._v("供其他 LDAP bean 使用,定义 LDAP 服务器的位置和用于连接它的其他信息(例如用户名和密码,如果它不允许匿名访问的话)。它还可以用于创建用于测试的嵌入式服务器。这两个选项的语法细节在"),t("RouterLink",{attrs:{to:"/authentication/passwords/ldap.html#servlet-authentication-ldap"}},[e._v("LDAP 章节")]),e._v("中都有涉及。实际的"),t("code",[e._v("ContextSource")]),e._v("实现是"),t("code",[e._v("DefaultSpringSecurityContextSource")]),e._v(",它扩展了 Spring LDAP 的"),t("code",[e._v("LdapContextSource")]),e._v("类。"),t("code",[e._v("manager-dn")]),e._v(""),t("code",[e._v("manager-password")]),e._v("属性分别映射到后者的"),t("code",[e._v("userDn")]),e._v(""),t("code",[e._v("password")]),e._v("属性。")],1),e._v(" "),t("p",[e._v("如果在应用程序上下文中只定义了一个服务器,那么其他 LDAP 命名空间定义的 bean 将自动使用它。否则,你可以给元素一个“id”属性,并使用"),t("code",[e._v("server-ref")]),e._v("属性从其他名称空间 bean 引用它。这实际上是"),t("code",[e._v("id")]),e._v("实例的 Bean "),t("code",[e._v("id")]),e._v(",如果你想在其他传统的 Spring bean 中使用它的话。")]),e._v(" "),t("h3",{attrs:{id:"ldap-server-属性"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-server-属性"}},[e._v("#")]),e._v(" <ldap-server>属性")]),e._v(" "),t("ul",[t("li",[t("p",[t("strong",[e._v("模式")]),e._v("显式指定应该使用哪个嵌入式 LDAP 服务器。值为"),t("code",[e._v("apacheds")]),e._v(""),t("code",[e._v("unboundid")]),e._v("。默认情况下,这将取决于 Classpath 中的库是否可用。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("身份证")]),e._v("一个 Bean 标识符,用于在上下文的其他地方引用 Bean。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("LDIF")]),e._v("显式指定要加载到嵌入式 LDAP 服务器中的 LDIF 文件资源。LDIF 应该是一个 Spring 资源模式(即 Classpath:init.ldif)。默认值是 Classpath *😗.ldif")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("Manager-dn")]),e._v("将用于对(非嵌入式)LDAP 服务器进行身份验证的“Manager”用户标识的用户名。如果省略,将使用匿名访问。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("管理器-密码")]),e._v("Manager DN 的密码。如果指定了 Manager-DN,这是必需的。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("港口")]),e._v("指定 IP 端口号。例如,用于配置嵌入式 LDAP 服务器。默认值是 33389。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("")]),e._v("嵌入式 LDAP 服务器的可选根后缀。默认为“dc=springframework,dc=org”")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("网址")]),e._v("指定不使用嵌入式 LDAP 服务器时的 LDAP 服务器 URL。")])])]),e._v(" "),t("h2",{attrs:{id:"ldap-authentication-provider"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-authentication-provider"}},[e._v("#")]),e._v(" <ldap-authentication-provider>")]),e._v(" "),t("p",[e._v("这个元素是创建"),t("code",[e._v("LdapAuthenticationProvider")]),e._v("实例的简写。默认情况下,这将被配置为"),t("code",[e._v("BindAuthenticator")]),e._v("实例和"),t("code",[e._v("DefaultAuthoritiesPopulator")]),e._v("实例。与所有名称空间身份验证提供者一样,它必须作为"),t("code",[e._v("authentication-provider")]),e._v("元素的子元素包含。")]),e._v(" "),t("h3",{attrs:{id:"ldap-authentication-provider-的父元素"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-authentication-provider-的父元素"}},[e._v("#")]),e._v(" <ldap-authentication-provider>的父元素")]),e._v(" "),t("ul",[t("li",[t("RouterLink",{attrs:{to:"/spring-security/authentication-manager.html#nsa-authentication-manager"}},[e._v("身份验证管理器")])],1)]),e._v(" "),t("h3",{attrs:{id:"ldap-authentication-provider-属性"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-authentication-provider-属性"}},[e._v("#")]),e._v(" <ldap-authentication-provider>属性")]),e._v(" "),t("ul",[t("li",[t("p",[t("strong",[e._v("组-角色-属性")]),e._v("包含将在 Spring Security 中使用的角色名的 LDAP 属性名。映射到"),t("code",[e._v("DefaultLdapAuthoritiesPopulator")]),e._v(""),t("code",[e._v("groupRoleAttribute")]),e._v("属性。默认为“cn”。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("群组搜索基础")]),e._v("搜索组成员搜索的基础。映射到"),t("code",[e._v("DefaultLdapAuthoritiesPopulator")]),e._v(""),t("code",[e._v("groupSearchBase")]),e._v("构造函数参数。默认值为“”(从根搜索)。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("组搜索过滤器")]),e._v("组搜索过滤器。映射到"),t("code",[e._v("DefaultLdapAuthoritiesPopulator")]),e._v(""),t("code",[e._v("groupSearchFilter")]),e._v("属性。默认值为"),t("code",[e._v("(uniqueMember={0})")]),e._v("。替换的参数是用户的 DN。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("角色前缀")]),e._v("一个非空的字符串前缀,它将被添加到从 Persistent 加载的角色字符串中。映射到"),t("code",[e._v("DefaultLdapAuthoritiesPopulator")]),e._v(""),t("code",[e._v("rolePrefix")]),e._v("属性。默认值为“role_”。在默认值为非空的情况下,使用值“none”表示无前缀。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("服务器-ref")]),e._v("可选使用的服务器。如果省略,并且注册了一个默认的 LDAP 服务器(使用没有 ID 的 <ldap-server>),则将使用该服务器。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("user-context-mapper-ref")]),e._v("通过指定一个 UserDetailsContextMapper Bean,允许对加载的用户对象进行显式定制,该用户对象将根据用户目录条目中的上下文信息被调用")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("用户-详细信息-类")]),e._v("允许指定用户条目的 ObjectClass。如果设置了,框架将尝试将定义的类的标准属性加载到返回的 UserDetails 对象中")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("user-dn-pattern")]),e._v("如果你的用户在目录中的固定位置(即你可以直接从用户名计算出 DN,而无需进行目录搜索),则可以使用此属性直接映射到 DN。它直接映射到"),t("code",[e._v("userDnPatterns")]),e._v(""),t("code",[e._v("AbstractLdapAuthenticator")]),e._v("属性。该值是用于构建用户 DN 的特定模式,例如"),t("code",[e._v("uid={0},ou=people")]),e._v("。键"),t("code",[e._v("{0}")]),e._v("必须存在,并将被用户名代替。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("用户搜索基础")]),e._v("用户搜索的搜索基础。默认值为“”。仅与“用户搜索过滤器”一起使用。")]),e._v(" "),t("p",[e._v("如果需要执行搜索以在目录中定位用户,则可以设置这些属性来控制搜索。"),t("code",[e._v("BindAuthenticator")]),e._v("将被配置为"),t("code",[e._v("FilterBasedLdapUserSearch")]),e._v(",并且属性值直接映射到该 Bean 构造函数的前两个参数。如果这些属性 AREN 没有设置,并且没有提供"),t("code",[e._v("user-dn-pattern")]),e._v("作为替代,那么将使用"),t("code",[e._v('user-search-filter="(uid={0})"')]),e._v(""),t("code",[e._v('user-search-base=""')]),e._v("的默认搜索值。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("用户搜索过滤器")]),e._v("用于搜索用户的 LDAP 过滤器(可选)。例如"),t("code",[e._v("(uid={0})")]),e._v("。替换的参数是用户的登录名。")]),e._v(" "),t("p",[e._v("如果需要执行搜索以在目录中定位用户,则可以设置这些属性来控制搜索。"),t("code",[e._v("BindAuthenticator")]),e._v("将被配置为"),t("code",[e._v("FilterBasedLdapUserSearch")]),e._v(",并且属性值直接映射到该 Bean 构造函数的前两个参数。如果没有设置这些属性 AREN,并且没有提供"),t("code",[e._v("user-dn-pattern")]),e._v("作为替代选项,那么将使用"),t("code",[e._v('user-search-filter="(uid={0})"')]),e._v(""),t("code",[e._v('user-search-base=""')]),e._v("的默认搜索值。")])])]),e._v(" "),t("h3",{attrs:{id:"ldap-authentication-provider-的子元素"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-authentication-provider-的子元素"}},[e._v("#")]),e._v(" <ldap-authentication-provider>的子元素")]),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"#nsa-password-compare"}},[e._v("密码-比较")])])]),e._v(" "),t("h2",{attrs:{id:"password-compare"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#password-compare"}},[e._v("#")]),e._v(" <password-compare>")]),e._v(" "),t("p",[e._v("这被用作"),t("code",[e._v("<ldap-provider>")]),e._v("的子元素,并将身份验证策略从"),t("code",[e._v("BindAuthenticator")]),e._v("切换到"),t("code",[e._v("PasswordComparisonAuthenticator")]),e._v("")]),e._v(" "),t("h3",{attrs:{id:"password-compare-的父元素"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#password-compare-的父元素"}},[e._v("#")]),e._v(" <password-compare>的父元素")]),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"#nsa-ldap-authentication-provider"}},[e._v("LDAP-身份验证-提供者")])])]),e._v(" "),t("h3",{attrs:{id:"password-compare-属性"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#password-compare-属性"}},[e._v("#")]),e._v(" <password-compare>属性")]),e._v(" "),t("ul",[t("li",[t("p",[t("strong",[e._v("散列")]),e._v("定义了用于用户密码的散列算法。我们强烈建议不要使用 MD4,因为它是一种非常弱的散列算法。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("密码属性")]),e._v("目录中包含用户密码的属性。默认值为“userpassword”。")])])]),e._v(" "),t("h3",{attrs:{id:"password-compare-的子元素"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#password-compare-的子元素"}},[e._v("#")]),e._v(" <password-compare>的子元素")]),e._v(" "),t("ul",[t("li",[t("RouterLink",{attrs:{to:"/spring-security/authentication-manager.html#nsa-password-encoder"}},[e._v("密码编码器")])],1)]),e._v(" "),t("h2",{attrs:{id:"ldap-user-service"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-user-service"}},[e._v("#")]),e._v(" <ldap-user-service>")]),e._v(" "),t("p",[e._v("这个元素配置一个 LDAP"),t("code",[e._v("UserDetailsService")]),e._v("。所使用的类是"),t("code",[e._v("LdapUserDetailsService")]),e._v(",它是"),t("code",[e._v("FilterBasedLdapUserSearch")]),e._v(""),t("code",[e._v("DefaultLdapAuthoritiesPopulator")]),e._v("的组合。它支持的属性具有与"),t("code",[e._v("<ldap-provider>")]),e._v("中相同的用法。")]),e._v(" "),t("h3",{attrs:{id:"ldap-user-service-属性"}},[t("a",{staticClass:"header-anchor",attrs:{href:"#ldap-user-service-属性"}},[e._v("#")]),e._v(" <ldap-user-service>属性")]),e._v(" "),t("ul",[t("li",[t("p",[t("strong",[e._v("cache-ref")]),e._v("定义了对缓存的引用,以便与 UserDetailsService 一起使用。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("组-角色-属性")]),e._v("包含将在 Spring Security 中使用的角色名的 LDAP 属性名。默认为“cn”。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("群组搜索基础")]),e._v("搜索组成员搜索的基础。默认值为“”(从根搜索)。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("组搜索过滤器")]),e._v("组搜索过滤器。默认值为"),t("code",[e._v("(uniqueMember={0})")]),e._v("。替换的参数是用户的 DN。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("身份证")]),e._v(" Bean 标识符,用于在上下文的其他地方引用 Bean。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("角色前缀")]),e._v("一个非空的字符串前缀,它将被添加到从持久存储中加载的角色字符串中(例如“role_”)。在默认值为非空的情况下,使用值“none”表示无前缀。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("服务器-ref")]),e._v("可选使用的服务器。如果省略,并且注册了一个缺省的 LDAP 服务器(使用没有 ID 的 <ldap-server>),则将使用该服务器。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("user-context-mapper-ref")]),e._v("通过指定一个 UserDetailsContextMapper Bean,允许对加载的用户对象进行显式定制,该用户对象将根据用户目录条目中的上下文信息被调用")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("用户-详细信息-类")]),e._v("允许指定用户条目的 ObjectClass。如果设置了,框架将尝试将已定义类的标准属性加载到返回的 UserDetails 对象中")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("用户搜索基础")]),e._v("用户搜索的搜索基础。默认值为“”。仅与“用户搜索过滤器”一起使用。")])]),e._v(" "),t("li",[t("p",[t("strong",[e._v("用户搜索过滤器")]),e._v("用于搜索用户的 LDAP 过滤器(可选)。例如"),t("code",[e._v("(uid={0})")]),e._v("。替换的参数是用户的登录名。")])])]),e._v(" "),t("p",[t("RouterLink",{attrs:{to:"/spring-security/method-security.html"}},[e._v("方法安全性")]),t("RouterLink",{attrs:{to:"/spring-security/websocket.html"}},[e._v("WebSocket Security")])],1)])}),[],!1,null,null,null);r.default=v.exports}}]);