EasyAD 1.0.1

A library to handle Active Directory users

Install-Package EasyAD -Version 1.0.1
dotnet add package EasyAD --version 1.0.1
<PackageReference Include="EasyAD" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyAD --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

EasyAD

An easy way to interact with an Active Directory directly from your source.
IMPORTANT: ldaps might not work at the moment, since it´s not fully tested. I am assuming, that you´re the admin of this AD instance and you know what you are doing. I am absolutely not responsible for any errors or unexpected user deletion or something like that.

Implement EasyAD

After loading the nuget package the implementation is quite simple.
Simply create a handler object to interact with the Active Directory instance.

ADHandler handler = new ADHandler(ldapPath, ldapAdmin, ldapAdminPassWord, domainName, container);

The params from first to last are meaning the following:

  1. {string} ldapPath:

    The LDAP path of your AD instance. Be sure to send it with ldap:// and the ip or the domain of your AD instance. Be sure to make it reachable over the network, if you plan to connect your AD not from localhost

  2. {string} ldapAdmin:

    The username of your AD administrator or at least a user which has admin rights (If you have problems, connecting your AD, try to give the complete username like admin@example.com)

  3. {string} ldapAdminPassWord:

    The password of the given admin user account.

  4. {string} domainName:

    The domain name of the AD you want to interact with. For example this can be EXAMPLE.com (be sure to fit upper and lower case like in your AD)

  5. {string} container:

    The complete ldap connection string. This should fit your AD sections. For example this can be CN=Users,DC=EXAMPLE,DC=com

Interacting with the ADHandler object.

As the name of the library says, it is very easy. I think every developer should be able to interpret what every available Method of an ADHandler object is able tol do. If you don´t ... feel free to contact me.
IMHO only 1 method need a bit of further explanation.

Get specific values for an AD user

An AD user will be filled with the most "classic" attributes directly (like first name, surname, mail address and so) and stored into an ADUserDetail object. You can get a simple user with the handler or all users by using handler.GetAllDomainUsers().
But sometimes you want to know more than the classic attributes. You can also call the handler for that like I did it below.

 var val = handler.GetSpecificPropertyForUser(detailUser,adProperty);

The params from first to last are meaning the following:

  1. {ADUserDetail} detailUser:

    The object for your AD user which you want to know further attributes. You might get this by handler.GetAllDomainUsers() and then picking one of the users which was returned into a list.

  2. {enum ADProperty} adProperty:

    The AD property value you want to get. As this is an implemented enumeration you just have to select, which one exactly you want to know. I named them all as they are named directly in Active Directory. They should be self explaining I think.
    As the enums are transformed in an own class called ADProperties, instantiate a new object of this class to take one of those enums. Be sure to call the method like this:

 handler.GetSpecificPropertyForUser(adUserObject,new ADProperties().OBJECTCLASS);

EasyAD

An easy way to interact with an Active Directory directly from your source.
IMPORTANT: ldaps might not work at the moment, since it´s not fully tested. I am assuming, that you´re the admin of this AD instance and you know what you are doing. I am absolutely not responsible for any errors or unexpected user deletion or something like that.

Implement EasyAD

After loading the nuget package the implementation is quite simple.
Simply create a handler object to interact with the Active Directory instance.

ADHandler handler = new ADHandler(ldapPath, ldapAdmin, ldapAdminPassWord, domainName, container);

The params from first to last are meaning the following:

  1. {string} ldapPath:

    The LDAP path of your AD instance. Be sure to send it with ldap:// and the ip or the domain of your AD instance. Be sure to make it reachable over the network, if you plan to connect your AD not from localhost

  2. {string} ldapAdmin:

    The username of your AD administrator or at least a user which has admin rights (If you have problems, connecting your AD, try to give the complete username like admin@example.com)

  3. {string} ldapAdminPassWord:

    The password of the given admin user account.

  4. {string} domainName:

    The domain name of the AD you want to interact with. For example this can be EXAMPLE.com (be sure to fit upper and lower case like in your AD)

  5. {string} container:

    The complete ldap connection string. This should fit your AD sections. For example this can be CN=Users,DC=EXAMPLE,DC=com

Interacting with the ADHandler object.

As the name of the library says, it is very easy. I think every developer should be able to interpret what every available Method of an ADHandler object is able tol do. If you don´t ... feel free to contact me.
IMHO only 1 method need a bit of further explanation.

Get specific values for an AD user

An AD user will be filled with the most "classic" attributes directly (like first name, surname, mail address and so) and stored into an ADUserDetail object. You can get a simple user with the handler or all users by using handler.GetAllDomainUsers().
But sometimes you want to know more than the classic attributes. You can also call the handler for that like I did it below.

 var val = handler.GetSpecificPropertyForUser(detailUser,adProperty);

The params from first to last are meaning the following:

  1. {ADUserDetail} detailUser:

    The object for your AD user which you want to know further attributes. You might get this by handler.GetAllDomainUsers() and then picking one of the users which was returned into a list.

  2. {enum ADProperty} adProperty:

    The AD property value you want to get. As this is an implemented enumeration you just have to select, which one exactly you want to know. I named them all as they are named directly in Active Directory. They should be self explaining I think.
    As the enums are transformed in an own class called ADProperties, instantiate a new object of this class to take one of those enums. Be sure to call the method like this:

 handler.GetSpecificPropertyForUser(adUserObject,new ADProperties().OBJECTCLASS);

Release Notes

Summary of changes made in this release of the package.

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 109 3/5/2019