This plugin adds ldap support to Play! Framework 1 applications.
require:
- ldap -> ldap 1.5.0
repositories:
- sismicsNexusRaw:
type: http
artifact: "https://nexus.sismics.com/repository/sismics/[module]-[revision].zip"
contains:
- ldap -> *
Add the following parameters to application.conf:
# LDAP configuration
# ~~~~~~~~~~~~~~~~~~~~
ldap.mock=false
ldap.host=ldap.example.com
ldap.port=389
ldap.adminDn=cn=user,ou=group,dc=example,dc=com
ldap.adminPassword=12345678
ldap.baseDn=ou=people,dc=example,dc=com
Add the following annotation to inject an LDAP connection into your HTTP request:
@With({Ldap.class})
public class MyThings extends Controller {
public static void getUsersFromLdap() {
LdapConnection con = LdapContext.get().getLdapConnection();
con.search(...);
}
}
We recommand to mock LDAP in development mode and test profile.
Use the following configuration parameter:
ldap.mock=true
Play-ldap comes pre-initialized with some mock users.
You can add some test users in your fixtures:
if (LdapUtil.isMock()) {
MockLdap.entryList = Lists.newArrayList(
new DefaultEntry("cn=test1,ou=people,dc=example,dc=com"),
// ...
);
This software is released under the terms of the Apache License, Version 2.0. See LICENSE
for more
information or see https://opensource.org/licenses/Apache-2.0.