2022-03-08 16:41:38 +01:00
|
|
|
use std::io::Cursor;
|
|
|
|
use capnp::capability::Promise;
|
|
|
|
use capnp::Error;
|
|
|
|
use capnp_rpc::pry;
|
|
|
|
use rsasl::session::{Session, Step};
|
|
|
|
|
2022-03-11 22:13:54 +01:00
|
|
|
use api::authenticationsystem_capnp::authentication_system::{
|
|
|
|
Server as AuthenticationSystem,
|
|
|
|
StepParams, StepResults,
|
|
|
|
AbortParams, AbortResults,
|
2022-03-08 16:41:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub struct Authentication {
|
|
|
|
state: State,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum State {
|
|
|
|
InvalidMechanism,
|
|
|
|
Finished,
|
|
|
|
Aborted,
|
|
|
|
Running(Session)
|
|
|
|
}
|
|
|
|
|
2022-03-11 22:13:54 +01:00
|
|
|
impl AuthenticationSystem for Authentication {
|
2022-03-08 16:41:38 +01:00
|
|
|
fn step(&mut self, params: StepParams, mut results: StepResults) -> Promise<(), Error> {
|
2022-03-11 22:13:54 +01:00
|
|
|
unimplemented!();
|
2022-03-08 16:41:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn abort(&mut self, _: AbortParams, _: AbortResults) -> Promise<(), Error> {
|
|
|
|
std::mem::replace(&mut self.state, State::Aborted);
|
|
|
|
Promise::ok(())
|
|
|
|
}
|
|
|
|
}
|