# pam - Safe Rust API to the Linux Pluggable Authentication Modules (PAM)
[![Crates.io](https://img.shields.io/crates/v/pam.svg)](https://crates.io/crates/pam)
[![Documentation](https://docs.rs/pam/badge.svg)](https://docs.rs/pam/)
[![Build Status](https://dev.azure.com/1wilkens/ci/_apis/build/status/pam?branchName=master)](https://dev.azure.com/1wilkens/ci/_build/latest?definitionId=2&branchName=master)
[![License](https://img.shields.io/crates/l/pam.svg?branch=master)](https://travis-ci.org/1wilkens/pam)
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:
```toml
[dependencies]
pam = "0.7.0"
```
2. Use the `Authenticator` struct to authenticate and open a session
```rust
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:
- [x] Implement basic user/password authentication
- [x] Add `Authenticator` struct
- [ ] Add (more) documentation
- [x] Verify current `conv` does not leak memory
- [x] 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](http://semver.org). 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
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
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_linux的可插入身份验证模块(PAM)的Safe Rust API 开发技术.zip
共20个文件
rs:10个
yml:2个
toml:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 164 浏览量
2023-09-25
14:39:15
上传
评论
收藏 26KB ZIP 举报
温馨提示
pam_linux的可插入身份验证模块(PAM)的Safe Rust API 开发技术.zip
资源推荐
资源详情
资源评论
收起资源包目录
pam_linux的可插入身份验证模块(PAM)的Safe Rust API 开发技术.zip (20个子文件)
T
pam-master
Cargo.toml 704B
.travis.yml 272B
src
enums.rs 6KB
functions.rs 13KB
lib.rs 866B
types.rs 1KB
module.rs 5KB
client.rs 7KB
env.rs 2KB
conv.rs 5KB
examples
spawn_bash.rs 2KB
CHANGELOG.md 5KB
LICENSE-MIT 1KB
azure-pipelines.yml 324B
.gitignore 151B
macros
Cargo.toml 417B
src
lib.rs 3KB
.gitignore 151B
README.md 3KB
LICENSE-APACHE 11KB
A
共 20 条
- 1
资源评论
处处清欢
- 粉丝: 150
- 资源: 2471
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功