Git Product home page Git Product logo

directorylib's Introduction

DirectoryLib

A wrapper library for Active Directory (LDAP) authentication in .NET

Version Downloads

Install

Use the Package Manager Console to install the latest Wdc.DirectoryLib package.

Install-Package Wdc.DirectoryLib

Usage

Context context = new Context("domain-controller.example.com");
UserAccount user = context.GetUserByUpn("[email protected]");
AccountStatus status = context.Authenticate(user, "secure-password-123");

switch (status)
{
    case AccountStatus.InvalidPassword:
        // Password is incorrect. Please try again.
        break;
    case AccountStatus.ExpiredPassword:
        // Password has expired. Please reset your password.
        break;
    case AccountStatus.MustChangePassword:
        // Account flagged as 'User must change password at next log on.';
        break;
    case AccountStatus.UserLockedOut:
        // Account is locked. Contact IT to unlock your account.
        break;
    case AccountStatus.UserNotFound:
        // Account does not exist in Active Directory.
        break;
    case AccountStatus.Success:
        // Password is correct, so do stuff
		if (!IsRegistered(user.ObjectGuid))
    		Register(user.ObjectGuid, user.DisplayName, user.Email);
        break;
}

Why?

Here at Western Digital, each employee has an account in Active Directory they use to sign into Windows. Most of our apps query Active Directory as a means to authenticate users and read attributes about the user such as name, email, and city.

We found our developers were often reinventing the wheel, so this library is an attempt to consolidate our efforts by making a C# wrapper that is type safe and easy to use.

Building

Requirements:

  • Visual Studio 2015 (VS 2010+ will work)
  • Target Framework .NET 3.5

Run msbuild Wdc.DirectoryLib.csproj to build as Release.

Packaging

  1. Increment <version> and update <releaseNotes> in the .nuspec file
  2. Download nuget.exe from http://nuget.org
  3. Run nuget pack Wdc.DirectoryLib.csproj to build and generate .nupkg file
  4. Upload the new package to nuget.org
  5. Zip binaries and attach to GitHub releases

Contributing

Pull requests are welcome! We currently do not have any public tests available, but send us a pull request and we'll try it out and merge it in.

License

MIT

directorylib's People

Contributors

hselin avatar muneeb456 avatar styfle avatar

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.