Skip to content
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

Detect the connection #674

Open
gaurav1992 opened this issue Oct 17, 2024 · 1 comment
Open

Detect the connection #674

gaurav1992 opened this issue Oct 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@gaurav1992
Copy link

Is there any method that can detect the connection whether it is an active directory or openLdap accordingly use classes? As both have different classes to use.

Thank you.

@gaurav1992 gaurav1992 added the enhancement New feature or request label Oct 17, 2024
@stevebauman
Copy link
Member

stevebauman commented Oct 17, 2024

Hi @gaurav1992,

Unfortunately there's no direct way of retrieving what type of LDAP server you are connected to. Some servers may provide some hints/evidence in their Root DSE object (can be retrieved by calling \LdapRecord\Models\Entry::getRootDse()), but this isn't consistently implemented across all providers.

The only way to do this is to identify them as such in your application, which you can do by naming the connections by supplying their name in the second parameter of the Container::addConnection method:

use LdapRecord\Container;
use LdapRecord\Connection;

Container::addConnection(new Connection([...]), 'openldap');

// ...

Container::addConnection(new Connection([...]), 'activedirectory');

Let me know if you have any further questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants