mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-31 21:03:09 +01:00
sso(authentik): always surface current provider refresh token from exchange
This commit is contained in:
parent
3f010a50af
commit
e16a24233c
1 changed files with 13 additions and 5 deletions
|
|
@ -240,11 +240,19 @@ impl Client {
|
|||
Ok(token_response) => token_response,
|
||||
};
|
||||
|
||||
Ok((
|
||||
token_response.refresh_token().map(|token| token.secret().clone()),
|
||||
token_response.access_token().secret().clone(),
|
||||
token_response.expires_in(),
|
||||
))
|
||||
// Always surface a refresh token:
|
||||
// - If the IdP (e.g., Authentik) returned a rotated one, use it.
|
||||
// - Otherwise, keep using the one we just used for this request.
|
||||
let access = token_response.access_token().secret().clone();
|
||||
let expires_in = token_response.expires_in();
|
||||
|
||||
let new_refresh = token_response
|
||||
.refresh_token()
|
||||
.map(|t| t.secret().clone())
|
||||
.unwrap_or_else(|| rt.secret().clone());
|
||||
|
||||
Ok((Some(new_refresh), access, expires_in))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue