DreamFactory 2.0 has built-in support for Active Directory authentication over LDAP. Developers can now provide the ability for their users to sign in using their enterprise/corporate login credentials. In other words, you can now easily set up an enterprise app to allow users to sign in using their corporate username and password, eliminating the need for creating and remembering yet another set username and password for their app.
AD/LDAP in DreamFactory 2.0 works just like other services in DreamFactory. It starts with provisioning an AD/LDAP service using the Services tab in the DreamFactory 2.0 admin console. While provisioning the service, simply specify your Active Directory server details such as hostname, base DN etc., as well as a default role. This role will be used for any users authenticating using your AD/LDAP service. You can easily create a role in DreamFactory 2.0 using the admin console. Here is a short how-to on setting up an AD/LDAP service with DreamFactory 2.0. We will start with setting up a role for our AD/LDAP service.
The ‘demo’ AD/LDAP service that we just provisioned is now ready for users to authenticate against an AD server over LDAP using a POST API call like this:
curl -i -k -X POST https://example.com/api/v2/user/session?service=demo
-d ‘{“username”:”jdoe”,”password”:”secret”}’
Alternatively you can also put the service name in the JSON payload, removing it from the url parameter like below.
curl -i -k -X POST https://example.com/api/v2/user/session
-d {“username”:”jdoe”, “password”:”secret”, “service”:”demo”}
DreamFactory 2.0 also includes all active AD/LDAP services in the system environment data. You can get the system environment data using a simple GET call.
curl -i -k -X GET https://example.com/api/v2/system/environment
The response from this call includes system authentication information, which shows APIs and services available in the system for logging in. This will help you create a proper login UI based on the services available in the system. Here is a sample response from ‘system/environment’ call showing the adldap services data.
{
...
"authentication": {
...
"adldap": [
{
"path": "user/session?service=demo",
"name": "demo",
"label": "AD/LDAP Demo",
"verb": "POST",
"payload": {
"username": "string",
"password": "string",
"service": "demo",
"remember_me": "bool"
}
}
]
},
}