Manu
Manu

Reputation: 4137

Create user in OpenDJ via REST

I am trying to build a request to create a new user in OpenDJ via REST API. According to the documentation, I need to create a new resource. The given example is fairly easy and it will create a user named "newuser" with the given field:

$ curl \
 --request PUT \
 --user kvaughan:bribery \
 --header "Content-Type: application/json" \
 --header "If-None-Match: *" \
 --data '{
  "_id": "newuser",
  "contactInformation": {
    "telephoneNumber": "+1 408 555 1212",
    "emailAddress": "[email protected]"
  },
  "name": {
    "familyName": "New",
    "givenName": "User"
  },
  "displayName": "New User",
  "manager": [
    {
      "_id": "kvaughan",
      "displayName": "Kirsten Vaughan"
    }
  ]
 }' \
 http://opendj.example.com:8080/users/newuser

However, the user I need to create must have a password, a common name and its username should be its email address. I cannot find a reference on how to build my JSON to create the required user so that it can be authenticated via username (email) and password.

Is there some documentation I can follow to build my JSON?

Upvotes: 0

Views: 1509

Answers (1)

Ludovic Poitou
Ludovic Poitou

Reputation: 4878

With LDAP directory services, the authentication is not based on a attribute such as username or email address, but based on the DistinguishedName of the entry. Typically an application will first issue a search based on the identifying attribute (which must have unique values for all users), and then the Bind request. The OpenDJ REST service works the same way. The _id field is mapped to the identifying attribute, and rules are defined in the http-config.json file to build the DN and entries. Please refer to OpenDJ Administration Guide and Reference Guide, and especially the REST API sections.

Upvotes: 1

Related Questions