aboutsummaryrefslogtreecommitdiff
path: root/lockchain-core/src/users/auth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lockchain-core/src/users/auth.rs')
-rw-r--r--lockchain-core/src/users/auth.rs65
1 files changed, 6 insertions, 59 deletions
diff --git a/lockchain-core/src/users/auth.rs b/lockchain-core/src/users/auth.rs
index aee3be1..1a8758c 100644
--- a/lockchain-core/src/users/auth.rs
+++ b/lockchain-core/src/users/auth.rs
@@ -3,9 +3,6 @@
//! The way a user is authenticated is via the `lockchain` group
//! and a simple writing/ deleting of a lock file.
-// use nix::sys::wait::*;
-// use nix::unistd::{fork, ForkResult};
-
use pam_auth::Authenticator;
use errors::AuthError;
@@ -23,60 +20,10 @@ use errors::AuthError;
/// yet due to issues in the `pam-auth` dependency.
#[allow(unused_variables)]
pub fn pam_authenticate(username: &str, password: &str) -> Result<(), AuthError> {
- // Err(AuthError::FailedPAM)
-
- // match fork().map_err(|_| AuthError::FailedFork)? {
- // ForkResult::Parent { child } => {
- // waitpid(child, None).unwrap();
- // // kill(child, SIGKILL).expect("kill failed");
- // }
- // ForkResult::Child => {
- // let mut auth = Authenticator::new("lockchain").ok_or(AuthError::FailedPAM)?;
-
- use std::error::Error;
- let service = "lockchain-core";
-
- println!("Username: {}", username);
- println!("Password: {}", password);
- println!("Service: {}", service);
-
- let mut auth = Authenticator::new(service).unwrap();
- auth.set_credentials(username, password);
-
- match auth.authenticate() {
- Ok(()) => println!("authenticate() OK!"),
- Err(e) => {
- println!("authenticate() FAILED!");
- println!("{}", e.description());
- println!("{:#?}", e.cause());
- }
- }
-
- match auth.open_session() {
- Ok(()) => println!("open_session() OK!"),
- Err(e) => {
- println!("open_session() FAILED!");
- println!("{}", e.description());
- println!("{:#?}", e.cause());
- }
- }
-
- Ok(())
-
- // auth.set_credentials(username, password);
- // auth.authenticate().map_err(|_| AuthError::InvalidUser)?;
- // auth.open_session().map_err(|_| AuthError::FailedPAM)?;
-
- // use std::process::Command;
- // let output = Command::new("su")
- // .arg(username)
- // .output()
- // .expect("failed to execute process");
- // println!("whoami: {:#?}", String::from_utf8(output.stdout).unwrap());
-
- // ::std::process::exit(255);
- // }
- // }
-
- // Ok(())
+ unimplemented!()
}
+
+/// Tbd...
+pub fn yubikey_authenticate(username: &str, yubi_id: &str) -> Result<(), AuthError> {
+ unimplemented!()
+} \ No newline at end of file