Skip to content

Repository files navigation

PAM for .NET

This library makes the PAM API available for .NET applications.

License

The library is released under the MIT license.

Example

The following example creates a PAM transaction and tries to authenticate a user.

// Create the servicevarpamService=newPamService(// The service optionsnewOptionsWrapper<PamSessionConfiguration>(newPamSessionConfiguration()));// The PAM message handlervarmessageHandler=newConsoleMessageHandler();// Create a PAM transactionusing(varpamTransaction=pamService.Start(messageHandler)){// Change the user promptpamTransaction.UserPrompt="my customized user login prompt: ";// AuthenticatepamTransaction.Authenticate();// Ensure that the user isn't locked (etc...)pamTransaction.AccountManagement();Console.WriteLine("User authentication for use {0} successful.",pamTransaction.UserName);}

Prerequisites

  • .NET Core 3.0

FAQ

Why .NET Core 3.0 (AKA: WHY???)

TL/DR: It makes my life easier.

This library uses the native library loading mechanism of .NET Core 3.0. This is required when you want to avoid using libdl.so, which is either only available in a -dev package, has a different name, depending on your operating system or distribution or other problems.

And no: netstandard2.1 doesn't support this API.

Support the development

Patreon

About

PAM bindings for .NET

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages