具有Active Directory和组托管服务帐户的Spring LDAP

问题描述

我们开发了一个Spring Application(5.2)。在此应用程序中,我们需要访问Active Directory以获取/读取所有“设备”。

我们使用Spring LDAP实现了它。创建LdapContextSource和LdapTemplate。到目前为止效果很好。

@Configuration
public class LdapConfiguration{

@Value("${ldap.url}")
private String url;
@Value("${ldap.base}")
private String base;
@Value("${ldap.username}")
private String username;
@Value("${ldap.password}")
private String password;

@Bean
public LdapContextSource ldapContextSource() throws Exception 
{
    PasswordPolicyAwareContextSource contextSource = new PasswordPolicyAwareContextSource(url);
    contextSource.setBase(base);
    contextSource.setUserDn(username);
    contextSource.setPassword(password);
 
    return contextSource;
}

@Bean
@Lazy(true)
public LdapTemplate ldapTemplate(LdapContextSource ldapContextSource)
{
    LdapTemplate ldapTemplate = new LdapTemplate(ldapContextSource);
    ldapTemplate.setIgnorePartialResultException(true); // for emptyLdapName and AD
    
    return ldapTemplate;
}

...
}

如您所见,我们从属性文件中获得了管理员的(技术)用户密码

现在有一个新的要求,不是使用单独的技术用户来绑定/访问AD,而是使用用户来启动应用程序。该用户是组托管服务帐户,因此该用户没有密码(如果有)... Windows Server环境,应用程序已作为Windows服务启动。

我试图找到任何例子-但是没有。...

还有其他具有GMSA和ActiveDirectory绑定的Java解决方案吗?

有什么建议吗?预先感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)