Skip to content

Integrating LDAP via Webhook ​

This page explains how to connect an existing enterprise LDAP directory to Kuboard: users enter their LDAP account on the Kuboard login page, and the password is validated against LDAP.

Audience: Kuboard administrators; you need a runnable HTTP service that fronts the LDAP directory.

This Is Not Single Sign-On (SSO)

Users still type their username and password on the Kuboard login page; only the password validation is forwarded to LDAP. To let users sign in without typing a password, use OIDC single sign-on instead.

Two Ways to Do This ​

ApproachWho It SuitsWhat It Takes
A. Run the official sample end to endYou want to confirm the Kuboard ↔ LDAP link worksStart the sample environment, change one setting, log in
B. Adapt it to your own LDAPYou already have LDAP and need a real integrationModify the sample; field mapping is below

Both work the same way: Kuboard forwards the login request to an HTTP address you provide (the "External User Webhook"), and that service queries LDAP on your behalf.

Be Careful If LDAP Already Enforces MFA

Kuboard's own MFA also applies to LDAP users: after LDAP validates the password, users are asked for a one-time code as well. If your enterprise already does multi-factor authentication in LDAP, use OIDC single sign-on instead and let the identity provider handle it.

Approach A: Run the Official Sample End to End ​

1. Start the Sample Environment ​

sh
git clone https://github.com/eip-work/kuboard-v4-ldap-example.git
cd kuboard-v4-ldap-example
docker compose up -d

The sample starts four containers:

ContainerPurposeHow to Reach It
openldapThe LDAP directoryldap://openldap:1389 inside the Docker network
kuboard-ldap-exampleThe webhook service, translating LDAP queries into the format Kuboard expectshttp://ldap-example:9090/api/kuboard/example/ldap-users inside the Docker network
dbThe Kuboard databasedb:3306 inside the Docker network
kuboardKuboard itselfOpen http://localhost:8000 in your browser

Two accounts are preloaded in the LDAP directory:

UsernamePasswordGroup
user01password1test-group
user02password2test-group

2. Enter the Webhook Address in Kuboard ​

  1. Open http://localhost:8000 and log in as admin / Kuboard123.
  2. Go to System Administration → Settings → System Settings → User Authentication Settings and scroll to the "External User Repository" card at the bottom of the page.
  3. Turn on the "Enable External User Webhook" toggle; the "External User Webhook" input appears below it.
  4. Enter http://ldap-example:9090/api/kuboard/example/ldap-users and click "Save".

The "External User Repository" section in User Authentication Settings

The Address Must Be Reachable from the Kuboard Server

This URL is requested by the Kuboard backend, not by the browser. Fill in an address the Kuboard server can resolve and reach; in the sample, Kuboard and the webhook service share one Docker network, which is why the service name ldap-example is used. Do not use localhost.

3. Log In with an LDAP Account ​

  1. Click your avatar in the top-right corner → Log out.
  2. On the login page, under "User Source", select "Webhook user repository".
  3. Enter user01 / password1 and click "Login"; reaching the home page means the link works.

Selecting "Webhook user repository" on the login page

Passwords Never Reach Kuboard

Kuboard only forwards the password to LDAP and stores nothing itself. A password changed in LDAP takes effect on the next login.

4. Grant Permissions to LDAP Users ​

An LDAP user has no permissions by default after logging in (the home page is all they can see). Permissions are granted exactly as for built-in users: user groups + roles.

  1. Go to System Administration → Users and Roles → Users and select "webhook" (the external user repository) in the "Source" dropdown at the top-left.
  2. Find user01 in the list, open it, switch to the "User Groups" tab, and click "Add User-Group Binding".
  3. Select an existing Kuboard user group (create one first under System Administration → Users and Roles → Groups if needed), set an expiry date, and click "OK".

The user list filtered by the Webhook user repository source

You Can Also Go the Other Way

On a group's detail page, use the "Users" tab and add user01 as a member. On the first binding, Kuboard creates the local record for that LDAP user automatically — the user does not have to log in first.

Once the group has roles bound to it, every member of the group gets those permissions immediately; see User Groups for how to bind roles.

Approach B: Adapt It to Your Own LDAP ​

What the Webhook Service Must Do ​

Implement 3 actions on the same HTTP address (Kuboard only knows this one address):

ActionKuboard's RequestWhat You Return
AuthenticatePOST {url} with body {"username": "...", "password": "..."}{"code": 0, "message": "ok"}
List usersGET {url}?pageNum=1&pageSize=10&username={"code": 0, "data": {"list": [...], "pageNum": 1, "pageSize": 10, "total": 1}}
Look up one userGET {url}?username=xxxSame shape, with only that user in list

code decides how Kuboard reacts:

codeMeaningWhat Kuboard Does
0SuccessAuthentication passes / the list is returned normally
1Authentication failedLogin rejected with "incorrect username or password"
2User not foundLogin rejected. To avoid revealing whether the account exists, return code = 1 for unknown users too
3Internal server errorThe login page reports a gateway error

See Webhook External User Library for the full request and response fields.

Which LDAP Attributes to Map ​

Webhook FieldCorresponding LDAP AttributeRequiredPurpose
usernameuidYesThe login name — how Kuboard identifies the user
fullNamecnNo"Full Name" column in user management
emailmailNo"Email" column in user management
groupsmemberOfNoDisplayed as "External Groups" in user management; grants no permissions by itself
createTimecreateTimestampNo"Create Time" column in user management

Adapting the Official Sample ​

The official sample is a Spring Boot application, so you only need to swap the LDAP queries for your own directory:

  1. Clone the sample and change the LDAP connection parameters (see the table below).
  2. Replace the hard-coded user groups with a read of memberOf (or whatever group attribute your directory uses).
  3. Run docker build -t <your-image-name>:v4 . and push it to a registry the Kuboard cluster can reach.
  4. Deploy that service on a network Kuboard can reach, and enter its address in Kuboard (same as step 2 of Approach A).

The sample's connection parameters:

Environment VariableMeaningSample Default
LDAP_URLLDAP server addressldap://localhost:1389
LDAP_USERNAMEAccount used to bind to LDAPcn=admin,dc=kuboard,dc=cn
LDAP_PASSWORDBind passwordKuboard123
LDAP_BASEBase DN where the users liveou=users,dc=kuboard,dc=cn

Common Problems ​

SymptomCauseWhat to Do
No "Webhook user repository" option on the login page"Enable External User Webhook" is off, or the change was not savedGo back to User Authentication Settings, confirm the toggle is on and saved
Login keeps saying the username or password is wrongThe webhook address is unreachable, or LDAP rejected the credentialsOn the machine running Kuboard, run curl -X POST <address> -H 'Content-Type: application/json' -d '{"username":"user01","password":"password1"}' and check the returned code
Login reports a gateway errorThe webhook service returned code=3 or threw an exceptionCheck the webhook service logs
No LDAP users in user managementThe "Source" dropdown was not switched to the external user repositorySelect "webhook" in the "Source" dropdown; the list is fetched from LDAP live every time it is opened
An LDAP user logs in and sees nothingNo user group is boundGo to Users and Roles → Users, find the user, and bind a user group
Password changed in LDAP but Kuboard still rejects itThe webhook service cached the old passwordCheck the webhook service's cache; Kuboard itself does not cache passwords

Security Recommendations ​

The Webhook Receives Plaintext Passwords

User passwords are POSTed in plaintext to the address you enter. Always use HTTPS, restrict the source IPs, and never put sensitive information in the returned message / details.

  • Bind to LDAP with a read-only account: the webhook service only needs to look up users and groups.
  • Kuboard can attach an HMAC signature to requests sent to the webhook (the webhookSharedSecret configuration item). The field is not exposed in the UI yet and must be written through the system configuration API; once set, have the webhook service verify the X-Kuboard-Webhook-Signature request header.
  • To let users sign in without typing a password, use OIDC single sign-on instead.

The APIs involved in this section are described in the Swagger UI "Authentication APIs" group.

Free Q&A

WeChat Group

Scan with WeChat to join the community and ask questions. No ads please.

Kuboard WeChat group QR code

Donate

Scan with WeChat to support us if Kuboard helps you.

Kuboard donate QR code