mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-22 14:57:56 +01:00
Fix auth
This commit is contained in:
parent
15f31ffd7c
commit
75c449c83a
10
src/api.rs
10
src/api.rs
@ -99,12 +99,18 @@ impl connection_capnp::bootstrap::Server for Bootstrap {
|
|||||||
|
|
||||||
let mechname = mechanism.as_bytes();
|
let mechname = mechanism.as_bytes();
|
||||||
let state = if let Ok(mechname) = Mechname::new(mechname) {
|
let state = if let Ok(mechname) = Mechname::new(mechname) {
|
||||||
if let Ok(session) = self.ctx.server_start(mechname) {
|
match self.ctx.server_start(mechname) {
|
||||||
|
Ok(session) => {
|
||||||
|
debug!(self.log, "Starting session using {}", mechname);
|
||||||
State::Running(session)
|
State::Running(session)
|
||||||
} else {
|
},
|
||||||
|
Err(error) => {
|
||||||
|
debug!(self.log, "Session start failed {:?}", error);
|
||||||
State::Aborted
|
State::Aborted
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
debug!(self.log, "Invalid mechname {:?}", mechname);
|
||||||
State::InvalidMechanism
|
State::InvalidMechanism
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ impl authentication::Server for Auth {
|
|||||||
let mut out = Cursor::new(Vec::new());
|
let mut out = Cursor::new(Vec::new());
|
||||||
match session.step(Some(data), &mut out) {
|
match session.step(Some(data), &mut out) {
|
||||||
Ok(Step::Done(data)) => {
|
Ok(Step::Done(data)) => {
|
||||||
|
trace!(self.log, "Authentication done!");
|
||||||
self.state = State::Finished;
|
self.state = State::Finished;
|
||||||
|
|
||||||
let uid = pry!(session.get_property::<AuthId>().ok_or(capnp::Error::failed(
|
let uid = pry!(session.get_property::<AuthId>().ok_or(capnp::Error::failed(
|
||||||
@ -173,10 +174,12 @@ impl authentication::Server for Auth {
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
Ok(Step::NeedsMore(_)) => {
|
Ok(Step::NeedsMore(_)) => {
|
||||||
|
trace!(self.log, "Authentication wants more data");
|
||||||
self.state = State::Aborted;
|
self.state = State::Aborted;
|
||||||
self.build_error(builder);
|
self.build_error(builder);
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(error) => {
|
||||||
|
trace!(self.log, "Authentication errored: {}", error);
|
||||||
self.state = State::Aborted;
|
self.state = State::Aborted;
|
||||||
self.build_error(builder);
|
self.build_error(builder);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user