如何在Spring引导应用程序中使用Active Directory docker映像进行授权

这是我第一次与Docker和AD合作。

我正在实现一个使用Active Directory进行授权的Spring启动应用程序。

我已经通过LDAP教程https://spring.io/guides/gs/authenticating-ldap/

我已经下载了Active Directory的docker镜像。

https://hub.docker.com/r/pitkley/samba-ad-dc/#environment-variables

现在我想在我的本地机器上使用这个docker图像进行授权。

Docker镜像正在运行,

$ docker run -i -t 041144877f9f /bin/bash root@3c01c419c248:/#

如何在春季启动应用程序中使用此映像进行授权?
我应该期待从这个docker形象?

我使用mac,java,spring boot。 以下是我的代码,

 @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest() .fullyAuthenticated() .and() .formLogin(); } @Override public void configure(AuthenticationManagerBuilder auth) throws Exception { auth .ldapAuthentication() .userDnPatterns("uid={0},ou=people") .groupSearchBase("ou=groups") .contextSource(contextSource()) .passwordCompare() .passwordEncoder(new LdapShaPasswordEncoder()) .passwordAttribute("userPassword"); } @Bean public DefaultSpringSecurityContextSource contextSource() { return new DefaultSpringSecurityContextSource(Arrays.asList("ldap://localhost:8389/"), "dc=springframework,dc=org"); } }