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-12 02:00:55 +01:00
|
|
|
use api::authenticationsystem_capnp::authentication::{
|
2022-03-11 22:13:54 +01:00
|
|
|
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> {
|
2022-03-12 01:27:58 +01:00
|
|
|
self.state = State::Aborted;
|
2022-03-08 16:41:38 +01:00
|
|
|
Promise::ok(())
|
|
|
|
}
|
|
|
|
}
|