在本文中,我们将详细介绍如果要从ActiveDirectory获取用户详细信息,是否需要编写CustomActiveDirectoryLdapAuthenticationProvider?的各个方面,
在本文中,我们将详细介绍如果要从ActiveDirectory获取用户详细信息,是否需要编写CustomActiveDirectoryLdapAuthenticationProvider?的各个方面,同时,我们也将为您带来关于active-directory – .net5 MVC6应用程序上的Active Directory / LDAP、active-directory – Active Directory,Linux和用户专用组、active-directory – Active Directory写入权限允许编辑用户信息,但不能编辑管理员用户信息、active-directory – Active Directory用户和计算机的限制视图的有用知识。
本文目录一览:- 如果要从ActiveDirectory获取用户详细信息,是否需要编写CustomActiveDirectoryLdapAuthenticationProvider?
- active-directory – .net5 MVC6应用程序上的Active Directory / LDAP
- active-directory – Active Directory,Linux和用户专用组
- active-directory – Active Directory写入权限允许编辑用户信息,但不能编辑管理员用户信息
- active-directory – Active Directory用户和计算机的限制视图
如果要从ActiveDirectory获取用户详细信息,是否需要编写CustomActiveDirectoryLdapAuthenticationProvider?
如果我们需要从ActiveDirectory中获取用户属性(例如名称,sn等),则不能使用Specialized
LDAP身份验证提供程序进行配置,该提供程序使用Active Directory配置约定,例如“
springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider”
@Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .authorizeRequests().antMatchers("/", "logout").permitAll().and().httpBasic(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(activeDirectoryLdapAuthenticationProvider()); } @Bean public AuthenticationManager authenticationManager() { return new ProviderManager(Arrays.asList(activeDirectoryLdapAuthenticationProvider())); } @Bean public AuthenticationProvider activeDirectoryLdapAuthenticationProvider() { ActiveDirectoryLdapAuthenticationProvider adProvider = new ActiveDirectoryLdapAuthenticationProvider(domain, url); adProvider.setConvertSubErrorCodesToExceptions(true); adProvider.setUseAuthenticationRequestCredentials(true); return adProvider; }
然后使用AuthenticationManager如下所示。
Authentication auth = new UsernamePasswordAuthenticationToken(userName, password); Authentication a = authenticationManager.authenticate(auth);
但是,对于正确的用户名和密码,我将a.isAuthenticated()设置为true,也将a.getName()作为我的用户名。但是,如何检索sn,dispalyname,name和其他属性。我们是否需要编写一个CustomActiveDirectoryLdapAuthenticationProvider,如此处
http://code-addict.pl/active-directory-spring-security/所述
答案1
小编典典你不。Spring Security带有一个UserDetailsContextMapper
接口
/** * Creates a fully populated UserDetails object for use by the security framework. * * @param ctx the context object which contains the user information. * @param username the user''s supplied login name. * @param authorities * @return the user object. */UserDetails mapUserFromContext(DirContextOperations ctx, String username, Collection<? extends GrantedAuthority> authorities);
默认实现LdapUserDetailsMapper
当前仅映射搜索返回的组。
// Map the rolesfor (int i = 0; (this.roleAttributes != null) && (i < this.roleAttributes.length); i++) { String[] rolesForAttribute = ctx.getStringAttributes(this.roleAttributes[i]); if (rolesForAttribute == null) { this.logger.debug("Couldn''t read role attribute ''" + this.roleAttributes[i] + "'' for user " + dn); continue; } for (String role : rolesForAttribute) { GrantedAuthority authority = createAuthority(role); if (authority != null) { essence.addAuthority(authority); } }}
但是,实现自己的 UserDetailsMapper 可以检索从LDAP返回的所有记录。
您只需确定要获取的属性
Object attribute = ctx.getObjectAttribute("some-ldap-attribute");
这是在身份验证事件期间获取自定义值的方式。
如果您只想查询和搜索并从LDAP目录中获取数据,则可以利用SpringSecurityLdapTemplate
它旨在模仿 RestTemplate 对于HTTP而不是LDAP的作用。
active-directory – .net5 MVC6应用程序上的Active Directory / LDAP
我看到有一个名为ADAL的解决方案,但我希望能够在没有Azure的情况下使用它.
我正在寻找一个类似于System.DirectoryServices的解决方案(只有一个与dnxcore50一起使用的解决方案).
谁有人能够让它工作?
解决方法
基本上使用“Windows身份验证”(活动目录)以及[授权]属性.
active-directory – Active Directory,Linux和用户专用组
我被告知在Active Directory环境中,您可能没有与用户同名的组名(具体而言,没有两个AD安全对象可能具有相同的名称).这似乎使我们将组定义移动到AD的过程变得复杂.看起来我们可以仅使用POSIX属性(例如,不是实际的AD安全对象)来维护AD中的NIS组信息,但这似乎是次优修复(因为我们确实希望在两者中具有相同的组成员身份视图) Unix和AD世界).
您是否已将大型旧版NIS环境移至Active Directory中?你是怎么处理这种情况的?
解决方法
>要解决名称冲突,我通过在开头添加“g”字符重命名用户私人组.例如:User = erik,Group = erik.现在,在活动目录中,我将组命名为“gerik”.通过这种方式,我可以继续专注于AD迁移,而无需立即考虑用户私有组问题.
>慢慢停止使用用户专用组,因为这似乎不是首选 – 至少在使用Active Directory时.这可以通过创建一个像“unixgrp”这样的新组或使用“Domain Users”来完成,但我不喜欢“Domain Users”,因为当显示带有“ls”的文件时,该名称太长了.
>从用户私人群组迁移到“unixgrp”等公共群组时要小心.不要只将所有文件的组更改为“unixgrp”.例如,如果用户对其用户专用组拥有的文件具有组写权限,并且您将组更改为“unixgrp”,则“unixgrp”中的所有用户也将具有该文件的写入权限.所以某种脚本必须以正确的方式修改权限……玩得开心!
我承认,在使用活动目录时,唯一真正的解决方案是以某种方式支持用户私有组.但是我不知道怎么做…
active-directory – Active Directory写入权限允许编辑用户信息,但不能编辑管理员用户信息
该组的成员现在可以编辑大多数用户信息,但他们无法编辑管理员的信息.但为什么?我没有找到任何可能导致这种情况的“拒绝”条款.
active-directory – Active Directory用户和计算机的限制视图
感谢您提前的时间.
http://technet.microsoft.com/en-us/library/cc546864.aspx
完成后,您将解锁列表对象模式,您将看到该模式作为可以分配给Active Directory对象的新权限或ACE.
它让人联想到Windows安全性中的“绕过遍历检查”权限,允许用户遍历他们没有权限的文件夹,以便访问他们有权访问的文件夹.
您主要看到多租户环境中使用的AD列表对象模式,其中您有多个客户共享同一个AD域,并且您不希望他们能够看到彼此的内容.
但请记住,除非您非常非常精确地使用您的权限,否则您将在客户端遇到组策略应用程序错误.客户端上的GP引擎需要读取gpLink,读取gpOptions,读取cn并读取链中每个OU上的distinguished Name,从它们一直驻留到域的根目录,否则GPO应用程序将失败.
今天关于如果要从ActiveDirectory获取用户详细信息,是否需要编写CustomActiveDirectoryLdapAuthenticationProvider?的介绍到此结束,谢谢您的阅读,有关active-directory – .net5 MVC6应用程序上的Active Directory / LDAP、active-directory – Active Directory,Linux和用户专用组、active-directory – Active Directory写入权限允许编辑用户信息,但不能编辑管理员用户信息、active-directory – Active Directory用户和计算机的限制视图等更多相关知识的信息可以在本站进行查询。
本文标签: