Code Monkey home page Code Monkey logo

activedirectory's Introduction

About 7 years history - start from 2010 (https://landpyactivedirectory.codeplex.com/), which will help you to manage Active Directory easily! This library has been used in Lenovo, Tempursealy, Sony, BoostSolutions and other corporations. Enjoy it! I have started my biz! https://fewbox.com

Get From Nuget: https://www.nuget.org/packages/Landpy.ActiveDirectory/

.Net Core Version

E.G: Update a user AD object.

using (var userObject = UserObject.FindOneByCN(this.ADOperator, “pangxiaoliang”))``
{
     if(userObject.Email == "[email protected]")``
     {
          userObject.Email = "[email protected]";``
          userObject.Save();``
     }
}

E.G: Query user AD objects.

// 1. CN end with "liu", Mail conatains "live" (Eg: [email protected]),
// job title is "Dev" and AD object type is user.
// 2. CN start with "pang", Mail conatains "live" (Eg: [email protected]),
// job title is "Dev" and AD object type is user.
            IFilter filter =
                new And(
                    new IsUser(),
                    new Contains(PersonAttributeNames.Mail, "live"),
                    new Is(PersonAttributeNames.Title, "Dev"),
                    new Or(
                            new StartWith(AttributeNames.CN, "pang"),
                            new EndWith(AttributeNames.CN, "liu")
                        )
                    );
// Output the user object display name.
foreach (var userObject in UserObject.FindAll(this.ADOperator, filter))
{
    using (userObject)
    {
        Console.WriteLine(userObject.DisplayName);
    }
}

E.G: Custom query.

IFilter filter =
    new And(
        new IsUser(),
        new Custom("(!userAccountControl:1.2.840.113556.1.4.803:=2)")
        );
// Output the user object display name.
foreach (var userObject in UserObject.FindAll(this.ADOperator, filter))
{
    using (userObject)
    {
        Console.WriteLine(userObject.DisplayName);
    }
}

activedirectory's People

Contributors

landpy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

activedirectory's Issues

How to enable Encryption when initializing the AD operator?

Hello everyone,

even though the project is not maintained anymore I hope to get help with my problem.

In our application we are using the Landpy library to authentificate users against the Active Directory.
One of our clients noticed that the

Frontend is communicating with LDAP over plain text. They asked if there is an option to enable SSH.

After some research I found out that the DirectoryEntry class has a property called AuthenticationType. The default value in your code is Secure and I think AuthenticationTypes.SecureSocketsLayer might be what I need.
The DirectoryEntry property in class UserObject is public but I see no way to set it's value when searching for a User Object in the AD. Here is the code for creating an AD Operator and searching for that user:

public void Init(string userLoginName, string password, string domain)
{
     var adOperator = new ADOperator(userLoginName, password, domain);
     user = UserObject.FindOneBySAMAccountName(adOperator, adOperator.GetOperatorInfo().UserLoginName);

     // I need this before calling "FindOneBySAMAccountName" method
     user.DirectoryEntry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;
}

Any idea how can I solve my issue?
Or am I on the wrong track and need to encrypt the communication between frontend registration and AD differently..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.