mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-22 06:47:56 +01:00
Pull more things from 0.3.2
This commit is contained in:
parent
495f9cb36a
commit
f367207d01
@ -6,6 +6,9 @@ use futures_signals::signal::{MutableSignalRef, ReadOnlyMutable, Signal};
|
||||
use futures_util::future::BoxFuture;
|
||||
use crate::resources::state::State;
|
||||
|
||||
mod shelly;
|
||||
|
||||
|
||||
pub trait Actor {
|
||||
fn apply(&mut self, state: State) -> BoxFuture<'static, ()>;
|
||||
}
|
||||
|
@ -1,11 +1,31 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use rsasl::error::SASLError;
|
||||
use rsasl::mechname::Mechname;
|
||||
use rsasl::SASL;
|
||||
use rsasl::session::Session;
|
||||
|
||||
pub mod db;
|
||||
|
||||
pub struct AuthenticationHandler {
|
||||
struct Inner {
|
||||
rsasl: SASL,
|
||||
}
|
||||
impl Inner {
|
||||
pub fn new(rsasl: SASL) -> Self {
|
||||
Self { rsasl }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AuthenticationHandler {
|
||||
inner: Arc<Inner>,
|
||||
}
|
||||
|
||||
impl AuthenticationHandler {
|
||||
|
||||
pub fn new(rsasl: SASL) -> Self {
|
||||
Self { inner: Arc::new(Inner::new(rsasl)) }
|
||||
}
|
||||
|
||||
pub fn start(&self, mechanism: &Mechname) -> Result<Session, SASLError> {
|
||||
self.inner.rsasl.server_start(mechanism)
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ impl AuthenticationSystem for Authentication {
|
||||
}
|
||||
|
||||
fn abort(&mut self, _: AbortParams, _: AbortResults) -> Promise<(), Error> {
|
||||
std::mem::replace(&mut self.state, State::Aborted);
|
||||
self.state = State::Aborted;
|
||||
Promise::ok(())
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user