Using spring embedded ldap to simulate active directory for integration tests : <p>I am using the Spring Security <code>ActiveDirectoryLdapAuthenticationProvider</code> with Spring Boot (annotation based config) to authenticate with Active Directory and generate tokens. All works fine. </p>

<p>I wish to add some integration tests that simulate the whole process, and I was thinking of maybe using the Spring embedded LDAP server for that.</p>

<p>I added this ldif file that I got from another example I found online. </p>

<pre><code>#Actual test data

dn: dc=test,dc=com
objectclass: top
objectclass: domain
objectclass: extensibleObject
dc: local

# Organizational Units
dn: ou=groups,dc=test,dc=com
objectclass: top
objectclass: organizationalUnit
ou: groups

dn: ou=people,dc=test,dc=com
objectclass: top
objectclass: organizationalUnit
ou: people

# Create People
dn: uid=testuser,ou=people,dc=test,dc=com
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
cn: Test
sn: User
uid: testuser
password: secret

# Create Groups
dn: cn=developers,ou=groups,dc=test,dc=com
objectclass: top
objectclass: groupOfUniqueNames
cn: developers
ou: developer
uniqueMember: uid=testuser,ou=people,dc=test,dc=com

dn: cn=managers,ou=groups,dc=test,dc=com
objectclass: top
objectclass: groupOfUniqueNames
cn: managers
ou: manager
uniqueMember: uid=testuser,ou=people,dc=test,dc=com
</code></pre>

<p>But this of course does not include any of the Active Directory schema stuff. 
Each user needs to have a <code>sAMAccountName</code> and needs to have the <code>memberOf</code> attribute to determine which groups it is in.</p>

<p>Is there any way to make this behave similar to active directory so that the Spring <code>ActiveDirectoryLdapAuthenticationProvider</code> binds to it with the user's username and password and gets its group membership to populate its authorities?</p>

<p>Otherwise if this is not viable, is there any other way to mock this and have a proper test?</p>
