-
Notifications
You must be signed in to change notification settings - Fork 36
Add LDAP as an option for authenticating a User. #1225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
codepitbull
wants to merge
14
commits into
master
Choose a base branch
from
feature/36525-ldap-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
554e05a
Add LDAP as an option for authenticating a User.
codepitbull 7f30877
Update hivemq-edge/src/test/java/com/hivemq/configuration/writer/Conf…
codepitbull 2acbcf1
Update hivemq-edge/src/test/java/com/hivemq/api/auth/provider/impl/ld…
codepitbull f472116
Fixing the config
codepitbull 1962177
SslUtil cleanup
codepitbull cc3add7
License header
codepitbull 74bc89b
Review comment
codepitbull efeef8d
Fix passwords
codepitbull a658ce5
CleanUp
codepitbull 7d81380
Merge branch 'master' into feature/36525-ldap-support
codepitbull f9a390e
Close connection in all exceptions
codepitbull b9165f1
Make sure to close the connection no matter which error happened
codepitbull 0491e01
Review comments
codepitbull dac5960
Review comments
codepitbull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
hivemq-edge/src/distribution/conf/examples/configuration/api/config-sample-ldap-api.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
~ Copyright 2025-present HiveMQ GmbH | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="config.xsd"> | ||
|
||
<!-- | ||
Example: Admin API with LDAP Authentication | ||
|
||
This configuration enables LDAP-based authentication for the Admin API. | ||
Instead of managing users in the config file, users are authenticated | ||
against an LDAP directory server. | ||
|
||
Supported TLS modes: | ||
- NONE: Plain LDAP (port 389, not recommended for production) | ||
- LDAPS: LDAP over TLS from connection start (port 636, recommended) | ||
- START_TLS: Plain connection upgraded to TLS (port 389) | ||
--> | ||
|
||
<admin-api> | ||
<enabled>true</enabled> | ||
|
||
<!-- LDAP Authentication Configuration --> | ||
<ldap> | ||
<ldap-authentication> | ||
<!-- LDAP Server Configuration --> | ||
<host>ldap.example.com</host> | ||
<port>636</port> <!-- 636 for LDAPS, 389 for plain LDAP or START_TLS --> | ||
<tls-mode>LDAPS</tls-mode> <!-- Options: NONE, LDAPS, START_TLS --> | ||
|
||
<!-- TLS/SSL Configuration (required for LDAPS and START_TLS) --> | ||
<tls> | ||
<!-- Path to truststore containing CA certificates --> | ||
<truststore-path>/path/to/truststore.jks</truststore-path> | ||
<truststore-password>changeit</truststore-password> | ||
<truststore-type>JKS</truststore-type> <!-- JKS or PKCS12 --> | ||
</tls> | ||
|
||
<!-- Optional: Connection Timeouts (in milliseconds) --> | ||
<connect-timeout-millis>5000</connect-timeout-millis> <!-- 5 seconds --> | ||
<response-timeout-millis>10000</response-timeout-millis> <!-- 10 seconds --> | ||
|
||
<!-- | ||
User DN Template | ||
Defines how usernames are mapped to LDAP Distinguished Names. | ||
Placeholders: | ||
- {username}: The username entered in the login form | ||
- {baseDn}: The base DN specified below | ||
|
||
Examples: | ||
- OpenLDAP: uid={username},ou=people,{baseDn} | ||
- Active Directory: cn={username},cn=Users,{baseDn} | ||
- Email-based: mail={username},ou=staff,{baseDn} | ||
--> | ||
<user-dn-template>uid={username},ou=people,{baseDn}</user-dn-template> | ||
|
||
<!-- Base DN: The root of your LDAP directory tree --> | ||
<base-dn>dc=example,dc=com</base-dn> | ||
</ldap-authentication> | ||
</ldap> | ||
</admin-api> | ||
|
||
</hivemq> |
52 changes: 52 additions & 0 deletions
52
...ge/src/distribution/conf/examples/configuration/api/config-sample-ldap-system-cas-api.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
~ Copyright 2025-present HiveMQ GmbH | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="config.xsd"> | ||
|
||
<!-- | ||
Example: Admin API with LDAP Authentication using System CA Certificates | ||
|
||
This configuration uses the system's default CA certificates for TLS validation. | ||
This is suitable when your LDAP server uses certificates signed by well-known | ||
certificate authorities (e.g., Let's Encrypt, DigiCert, etc.). | ||
|
||
No custom truststore configuration is needed. | ||
--> | ||
|
||
<admin-api> | ||
<enabled>true</enabled> | ||
|
||
<ldap> | ||
<ldap-authentication> | ||
<!-- LDAP Server Configuration --> | ||
<host>ldap.example.com</host> | ||
<port>636</port> | ||
<tls-mode>LDAPS</tls-mode> | ||
|
||
<!-- No <tls> section needed - system CA certificates will be used --> | ||
|
||
<!-- User DN Template for Active Directory --> | ||
<user-dn-template>cn={username},cn=Users,{baseDn}</user-dn-template> | ||
|
||
<!-- Base DN --> | ||
<base-dn>dc=company,dc=local</base-dn> | ||
</ldap-authentication> | ||
</ldap> | ||
</admin-api> | ||
|
||
</hivemq> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
...e/src/main/java/com/hivemq/api/auth/provider/impl/SimpleUsernamePasswordProviderImpl.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.