Reputation: 2103
I have some code that allows administrators to manage their organization's users/groups etc and execute extended commands (such as disabling accounts etc). This code is completely separate from the main user application and is only accessible by admins. As such I connect to LDAP using the admin user so I have access to all the commands I need.
What I'm wondering is if I can simply instantiate my LdapConnection, then bind to the server and then cache that connection for use throughout the app (store it in the Application object or in Session for instance) rather than instantiating it and binding every time I need to make a call? In other words, does that LdapConnection object ever expire or timeout or unbind after a certain amount of time? It looks like it has a 'Timeout' property on the connection object but that appears to be per each individual call. Am I correct to assume that once I bind I can just keep using that connection? Any design reason not to do this?
thank you!
Upvotes: 1
Views: 1714
Reputation: 11134
Depending on the configuration of the directory server you're using, it might be configured to:
Once the connection has been associated with an authentication identity by use of the BIND operation (known as establishing an authorization state for the connection), that authentication state remains in effect for the life of the connection, or until the next BIND request is sent on that connection.
Upvotes: 2
Reputation: 310850
I'm no C# expert but I would expect the LdapConnection object to overlay a connection pool rather than represent a physical connection itself.
Upvotes: 0