mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
fix: saved credentials not working
This commit is contained in:
parent
54e2371022
commit
6fbd7ceb9c
@ -196,11 +196,7 @@ impl Credential {
|
||||
),
|
||||
// Use the empty string as the password if auth_cookie is present
|
||||
Credential::Cached(cred) => (
|
||||
if cred.auth_cookie.is_some() {
|
||||
None
|
||||
} else {
|
||||
cred.password()
|
||||
},
|
||||
cred.password(),
|
||||
None,
|
||||
cred.auth_cookie.as_ref().map(|c| c.user_auth_cookie()),
|
||||
cred.auth_cookie.as_ref().map(|c| c.prelogon_user_auth_cookie()),
|
||||
|
@ -103,6 +103,20 @@ pub async fn retrieve_config(portal: &str, cred: &Credential, gp_params: &GpPara
|
||||
let client = Client::try_from(gp_params)?;
|
||||
|
||||
let mut params = cred.to_params();
|
||||
// Avoid sending the auth cookies for the portal config API if the password is cached
|
||||
// Otherwise, the portal will return an error even if the password is correct, because
|
||||
// the auth cookies could have been invalidated and the portal server takes precedence
|
||||
// over the password
|
||||
if let Credential::Cached(cache_cred) = cred {
|
||||
if cache_cred.password().is_some() {
|
||||
info!("Using cached credentials, excluding auth cookies from the portal config request");
|
||||
|
||||
params.remove("prelogin-cookie");
|
||||
params.remove("portal-userauthcookie");
|
||||
params.remove("portal-prelogonuserauthcookie");
|
||||
}
|
||||
}
|
||||
|
||||
let extra_params = gp_params.to_params();
|
||||
|
||||
params.extend(extra_params);
|
||||
|
Loading…
Reference in New Issue
Block a user