Skip to content

Commit

Permalink
Additional debug for Hello auth
Browse files Browse the repository at this point in the history
Signed-off-by: David Mulder <dmulder@samba.org>
  • Loading branch information
dmulder committed Apr 12, 2024
1 parent 6c4b23b commit 913a312
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions src/common/src/idprovider/himmelblau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,23 @@ impl IdProvider for HimmelblauProvider {

match self.token_validate(account_id, &token).await {
Ok(AuthResult::Success { token }) => {
debug!("Returning user token from successful Hello PIN setup and authentication.");
Ok((AuthResult::Success { token }, AuthCacheAction::None))
}
/* This should never happen. It doesn't make sense to
* continue from a Pin auth. */
Ok(AuthResult::Next(_)) => Err(IdpError::BadRequest),
Ok(auth_result) => Ok((auth_result, AuthCacheAction::None)),
Err(e) => Err(e),
Ok(AuthResult::Next(_)) => {
debug!("Invalid additional authentication requested with Hello auth.");
Err(IdpError::BadRequest)
}
Ok(auth_result) => {
debug!("Hello auth failed.");
Ok((auth_result, AuthCacheAction::None))
}
Err(e) => {
error!("Error encountered during Hello auth: {:?}", e);
Err(e)
}
}
}
(AuthCredHandler::Pin, PamAuthRequest::Pin { cred }) => {
Expand Down Expand Up @@ -674,13 +684,23 @@ impl IdProvider for HimmelblauProvider {

match self.token_validate(account_id, &token).await {
Ok(AuthResult::Success { token }) => {
debug!("Returning user token from successful Hello PIN authentication.");
Ok((AuthResult::Success { token }, AuthCacheAction::None))
}
/* This should never happen. It doesn't make sense to
* continue from a Pin auth. */
Ok(AuthResult::Next(_)) => Err(IdpError::BadRequest),
Ok(auth_result) => Ok((auth_result, AuthCacheAction::None)),
Err(e) => Err(e),
Ok(AuthResult::Next(_)) => {
debug!("Invalid additional authentication requested with Hello auth.");
Err(IdpError::BadRequest)
}
Ok(auth_result) => {
debug!("Hello auth failed.");
Ok((auth_result, AuthCacheAction::None))
}
Err(e) => {
error!("Error encountered during Hello auth: {:?}", e);
Err(e)
}
}
}
(AuthCredHandler::Password, PamAuthRequest::Password { cred }) => {
Expand Down Expand Up @@ -988,7 +1008,10 @@ impl IdProvider for HimmelblauProvider {
Err(e) => Err(e),
}
}
_ => Err(IdpError::NotFound),
_ => {
error!("Unexpected AuthCredHandler and PamAuthRequest pairing");
Err(IdpError::NotFound)
}
}
}

Expand Down

0 comments on commit 913a312

Please sign in to comment.