mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
spotify: check cached creds username before use
If a username was specified, only use cached credentials that match that username. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1192>
This commit is contained in:
parent
8d6751c88d
commit
3d01c9b363
1 changed files with 25 additions and 10 deletions
|
@ -132,7 +132,21 @@ impl Settings {
|
|||
let cache = Cache::new(credentials_cache, None, files_cache, max_size)?;
|
||||
|
||||
if let Some(cached_cred) = cache.credentials() {
|
||||
gst::debug!(cat, obj: &src, "reuse credentials from cache",);
|
||||
if !self.username.is_empty() && self.username != cached_cred.username {
|
||||
gst::debug!(
|
||||
cat,
|
||||
obj: &src,
|
||||
"ignore cached credentials for user {} which mismatch user {}",
|
||||
cached_cred.username,
|
||||
self.username
|
||||
);
|
||||
} else {
|
||||
gst::debug!(
|
||||
cat,
|
||||
obj: &src,
|
||||
"reuse cached credentials for user {}",
|
||||
cached_cred.username
|
||||
);
|
||||
if let Ok((session, _credentials)) = Session::connect(
|
||||
SessionConfig::default(),
|
||||
cached_cred,
|
||||
|
@ -144,6 +158,7 @@ impl Settings {
|
|||
return Ok(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gst::debug!(
|
||||
cat,
|
||||
|
|
Loading…
Reference in a new issue