auth-dialog: Implement dummy stage

It is not supposed to require user interaction so it's a waste to use
the fallback URL.
This commit is contained in:
Kévin Commaille 2023-07-18 14:49:56 +02:00
parent e8ed5a99a5
commit ec317a0d77
No known key found for this signature in database
GPG key ID: 29A48C1F03620416

View file

@ -241,6 +241,7 @@ impl AuthDialog {
match stage { match stage {
AuthType::Password => Some(self.perform_password_stage(session.clone()).await), AuthType::Password => Some(self.perform_password_stage(session.clone()).await),
AuthType::Sso => Some(self.perform_fallback(session.clone(), stage).await), AuthType::Sso => Some(self.perform_fallback(session.clone(), stage).await),
AuthType::Dummy => Some(self.perform_dummy_stage(session.clone())),
// TODO implement other authentication types // TODO implement other authentication types
// See: https://gitlab.gnome.org/GNOME/fractal/-/issues/835 // See: https://gitlab.gnome.org/GNOME/fractal/-/issues/835
_ => None, _ => None,
@ -264,6 +265,11 @@ impl AuthDialog {
Ok(AuthData::Password(data)) Ok(AuthData::Password(data))
} }
/// Performs the dummy stage.
fn perform_dummy_stage(&self, session: Option<String>) -> Result<AuthData, AuthError> {
Ok(AuthData::Dummy(assign!(Dummy::new(), { session })))
}
/// Performs a web-based fallback for the given stage. /// Performs a web-based fallback for the given stage.
async fn perform_fallback( async fn perform_fallback(
&self, &self,