mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-29 11:16:14 +01:00
Fix credentials managers to consistently return Password
This commit is contained in:
parent
b41afde2c9
commit
7d27b6d140
@ -74,7 +74,10 @@ class AbstractCredentialsManager:
|
|||||||
|
|
||||||
class PlaintextConfigFileCredentialsManager(AbstractCredentialsManager):
|
class PlaintextConfigFileCredentialsManager(AbstractCredentialsManager):
|
||||||
def get_password(self, url, user, defer=True, apiurl=None):
|
def get_password(self, url, user, defer=True, apiurl=None):
|
||||||
return self._cp.get(url, 'pass', raw=True)
|
password = self._cp.get(url, "pass", fallback=None, raw=True)
|
||||||
|
if password is None:
|
||||||
|
return None
|
||||||
|
return conf.Password(password)
|
||||||
|
|
||||||
def set_password(self, url, user, password):
|
def set_password(self, url, user, password):
|
||||||
self._cp.set(url, 'pass', password)
|
self._cp.set(url, 'pass', password)
|
||||||
@ -108,7 +111,8 @@ class ObfuscatedConfigFileCredentialsManager(PlaintextConfigFileCredentialsManag
|
|||||||
passwd = self._cp.get(url, 'passx', raw=True)
|
passwd = self._cp.get(url, 'passx', raw=True)
|
||||||
else:
|
else:
|
||||||
passwd = super().get_password(url, user, apiurl=apiurl)
|
passwd = super().get_password(url, user, apiurl=apiurl)
|
||||||
return self.decode_password(passwd)
|
password = self.decode_password(passwd)
|
||||||
|
return conf.Password(password)
|
||||||
|
|
||||||
def set_password(self, url, user, password):
|
def set_password(self, url, user, password):
|
||||||
compressed_pw = bz2.compress(password.encode('ascii'))
|
compressed_pw = bz2.compress(password.encode('ascii'))
|
||||||
|
Loading…
Reference in New Issue
Block a user