mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:29:40 +01:00
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:
@@ -214,3 +214,23 @@ async fn errors_are_explained() {
|
||||
assert!(r.steps.iter().any(|s| s.id == "token" && s.summary.contains("invalid_grant") && s.status == StepStatus::Warning));
|
||||
assert_eq!(r.token.as_deref(), Some("at-cc"), "{:#?}", r.steps);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn undefined_variable_in_issuer_is_explained() {
|
||||
let c = cfg(serde_json::json!({ "type": "oidc", "issuer": "{{BASE}}/realms/default/", "client_id": "knock" }));
|
||||
let hooks = TestHooks::default();
|
||||
let r = oauth::action(&c, &c.store_key("c", None), &hooks, oauth::Action::Discovery).await;
|
||||
let failed = r.steps.iter().find(|s| s.status == StepStatus::Error).expect("error step");
|
||||
assert!(failed.summary.contains("{{BASE}}"), "{}", failed.summary);
|
||||
assert!(!r.steps.iter().any(|s| s.exchange.is_some()), "no request may be sent");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn issuer_with_trailing_slash_discovers() {
|
||||
let st = Arc::new(Mutex::new(Provider::default()));
|
||||
let base = start_provider(st).await;
|
||||
let c = cfg(serde_json::json!({ "type": "oauth2", "issuer": format!("{base}/"), "client_id": "knock" }));
|
||||
let hooks = TestHooks::default();
|
||||
let r = oauth::action(&c, &c.store_key("c2", None), &hooks, oauth::Action::Discovery).await;
|
||||
assert!(r.steps.iter().any(|s| s.id == "discovery" && s.status == StepStatus::Ok), "{:#?}", r.steps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user