https://github.com/sismics/play-ldap
This module adds LDAP support to Play! Framework 1 applications.
https://github.com/sismics/play-ldap
apache-directory directory ldap module play play-framework
Last synced: 11 months ago
JSON representation
This module adds LDAP support to Play! Framework 1 applications.
- Host: GitHub
- URL: https://github.com/sismics/play-ldap
- Owner: sismics
- License: apache-2.0
- Created: 2019-02-28T09:57:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-12-28T09:59:15.000Z (over 5 years ago)
- Last Synced: 2025-06-25T06:42:47.891Z (12 months ago)
- Topics: apache-directory, directory, ldap, module, play, play-framework
- Language: Java
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/sismics/play-ldap/releases/latest)
[](https://opensource.org/licenses/Apache-2.0)
# play-ldap plugin
This plugin adds [ldap](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) support to Play! Framework 1 applications.
# Features
# How to use
#### Add the dependency to your `dependencies.yml` file
```
require:
- ldap -> ldap 1.5.0
repositories:
- sismicsNexusRaw:
type: http
artifact: "https://nexus.sismics.com/repository/sismics/[module]-[revision].zip"
contains:
- ldap -> *
```
#### Set configuration parameters
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
```
#### Connect to LDAP
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(...);
}
}
```
#### Mock the connection in dev
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"),
// ...
);
```
# License
This software is released under the terms of the Apache License, Version 2.0. See `LICENSE` for more
information or see .