OAuth flows can be cancelled; discovery no longer waits for a pending login

- Only login, logout, refresh and revoke queue behind each other;
  discovery, test, userinfo and introspection run at once
- Cancel in the OAuth panel (and Cancel on the request) stops the flow,
  frees the callback port and the login lock
- Undefined variables in issuer, endpoints or client id are reported
  before any request is sent
- Keyring commands run off the UI thread, so a KWallet prompt cannot
  freeze the window
- One click on a collection opens its settings; the chevron folds it
- Until an environment is picked, local (or the first one) is active;
  the environment editor says when the shown one is not active
This commit is contained in:
2026-11-27 18:24:04 +01:00
parent e6913451e6
commit 5fc816a380
9 changed files with 194 additions and 40 deletions
+20
View File
@@ -169,6 +169,22 @@ impl<'a> Flow<'a> {
if c.grant == Grant::AuthorizationCode && c.issuer.is_empty() && c.authorize_url.is_empty() {
problems.push("the authorization code flow needs an authorize URL or an issuer".to_string());
}
// An undefined variable leaves `{{BASE}}` in a URL; fail here with the
// reason instead of sending a request to a broken address.
for (label, v) in [
("issuer", &c.issuer),
("authorize URL", &c.authorize_url),
("token URL", &c.token_url),
("device URL", &c.device_url),
("client id", &c.client_id),
] {
if let Some(start) = v.find("{{") {
let name = v[start + 2..].split("}}").next().unwrap_or("").trim();
problems.push(format!(
"the {label} uses {{{{{name}}}}}, which is not defined. Pick the environment that defines it (Ctrl+E) or define it in the collection"
));
}
}
if c.grant == Grant::Password && c.username.is_empty() {
problems.push("username is empty".to_string());
}
@@ -823,6 +839,10 @@ pub async fn action(cfg: &OauthConfig, key: &str, hooks: &dyn FlowHooks, what: A
let mut f = Flow { cfg, hooks, http: Http::new(cfg.verify_tls), steps: Vec::new(), warnings: Vec::new(), meta: None };
if matches!(what, Action::Discovery) {
DISCOVERY.lock().unwrap().get_or_insert_with(HashMap::new).remove(&cfg.issuer);
if cfg.issuer.contains("{{") {
f.check_config();
return FlowResult { steps: f.steps, warnings: f.warnings, ..Default::default() };
}
f.discover().await;
return FlowResult { steps: f.steps, warnings: f.warnings, ..Default::default() };
}