GithubHelp home page GithubHelp logo

thedcoder / pam-fork Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 1wilkens/pam

0.0 0.0 0.0 141 KB

Safe Rust API to the Linux Pluggable Authentication Modules (PAM)

Home Page: https://docs.rs/pam/

License: Apache License 2.0

Rust 100.00%

pam-fork's Introduction

pam - Safe Rust API to the Linux Pluggable Authentication Modules (PAM)

Crates.io Documentation Build Status License

Note: Currently only supports basic username/password authentication out-of-the-box.

Warning

Environment support through the env module is probably broken and should not be used in the current state!

Usage

  1. Add pam to your Cargo.toml:
[dependencies]
pam = "0.7.0"
  1. Use the Authenticator struct to authenticate and open a session
extern crate pam;
pub fn main() {
        let service = "<yourapp>";
        let user = "<user>";
        let password = "<pass>";

        let mut auth = pam::Authenticator::with_password(service).unwrap();
        auth.handler_mut().set_credentials(user, password);
        if auth.authenticate().is_ok() && auth.open_session().is_ok() {
            println!("Successfully opened a session!");
        }
        else {
            println!("Authentication failed =/");
        }
}

TODO:

  • Implement basic user/password authentication
  • Add Authenticator struct
  • Add (more) documentation
  • Verify current conv does not leak memory
  • Allow custom conv functions to be passed
  • Code cleanup

Supported Rust versions

The library is only continuously built against Rust stable, beta and nightly but as it does not use a lot of new language features it should probably compile on older versions as well. If you encounter problems building on older versions and a small fix can be applied to make the build succeed, consider opening a pull request.

Note about stability

This crate follows semantic versioning. As such all versions below 1.0.0 should be considered development versions. This means the API could change any time.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

pam-fork's People

Contributors

1wilkens avatar regiontog avatar elinorbgr avatar serpilliere avatar goorzhel avatar decodetalkers avatar nc7s avatar emberian avatar fabian-gruenbichler avatar klemens avatar mlsteele avatar blub avatar edneville avatar mtlll 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.