1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-11 07:06:16 +01:00
Commit Graph

23 Commits

Author SHA1 Message Date
mig4
b4afd1a8ea
Avoid crash when deleting a password
When using keyring, osc would crash when called as
`osc config ENDPOINT --change-password`
and when the password didn't exist in the backend.

This prevents it by first checking if a password exists.
2022-11-01 18:40:39 +00:00
a5b8729f2f Fix usage of super() 2022-09-09 09:33:51 +02:00
f8a8c9c91c Print user and apiurl when prompting for a password
It's not a good idea to send a password to a different server
than it belongs. Now the server identity is obvious.
2022-09-08 10:51:04 +02:00
41ceb4b5f8 Remove deprecated 'GnomeKeyringCredentialsManager' and related code 2022-08-25 13:20:25 +02:00
feb53212dd Modernize code with pyupgrade
pyupgrade --keep-percent-format --py36-plus `find -name '*.py'`
2022-07-28 19:14:12 +02:00
229913a77f Clean imports up, drop python 2 fallbacks 2022-07-28 13:17:43 +02:00
133a6e340c Fix crash when 'pass' is not set in the config file 2022-07-26 15:07:40 +02:00
5e8413ecb6 Don't traceback on invalid credentials manager 2022-06-21 08:33:38 +02:00
Marcus Huewe
3262c05e35 Handle a callable in credentials._LazyPassword.__str__
It is possible that the self._pwfunc() call returns a callable. For
instance, if the keyutils.osc.OscKernelKeyringBackend is configured
in the oscrc. Hence, check in credentials._LazyPassword.__str__
if the returned password is a callable and, if so, call it. Moreover,
a deprecation warning is printed. Eventually, this compat code will
be removed again.

This is a follow-up commit for commit
784d330f20 ("Only prompt for a password
if the server asks for it") (actually, it is a regression that was
not caught during the review...).
2022-04-14 01:47:10 +02:00
Michael Schroeder
784d330f20
Only prompt for a password if the server asks for it
In many cases the session cookie is already available, so there
is no need to ask for a password. To make this work with the
python authentication implementation, we add a small proxy object
for the password and only ask the credential manager if the
stringify method is called.

This approach also makes it possible to offer a non-password based
authorization type if the server allows multiple authentication
methods.
2022-04-11 11:46:08 +02:00
Marco Strigl
64631f1d91
Merge pull request #754 from adrianschroeter/hot_fix
dealing with new exception errors
2022-03-31 10:59:50 +02:00
90a1cb838b Report a config error when trying to load credentials_mgr_class that does't exist 2022-03-28 09:49:55 +02:00
853a3848e8 Order credentials managers by priority 2022-03-28 09:49:55 +02:00
d3f4b7a930 Reword names and decriptions of credentials managers 2022-03-28 09:49:55 +02:00
8e0e0a9ca8 Cherry-pick supported python-keyring backends
Also provide pretty names and descriptions.
2022-03-28 09:49:55 +02:00
7370b23822 osc can crash due to various exceptions when loading
key management.

Not sure if this is the best way, but make osc usable at all again...
2022-03-16 14:19:01 +01:00
lethliel
6a20fd8bf5 fix list of backends for old python-keyring
old python-keyring classes have no name method.
This is used instead:

return self._keyring_backend.__class__.__name__
2020-02-14 09:35:07 +01:00
Marcus Huewe
f9b1fa18ad Move passx handling into ObfuscatedConfigFileCredentialsManager
Minor cleanup for commit c5231d61dd
("fix credentials with passx entries").
2019-11-04 14:25:48 +01:00
Andreas Schwab
5227e357bc Don't enforce password reuse 2019-11-03 13:43:22 +01:00
lethliel
c5231d61dd fix credentials with passx entries
Existing passx enries resulted in a stacktrace because
the cp.get() call for the passx entries was missing.

Also added a delete_password function for ObfuscatedPasswordManager
to delete passx entries
2019-10-29 11:04:22 +01:00
lethliel
5fa1e73db6 catch configured keyring without module installed
If a python-keyring based backend is configured, but
python-keyring is not installed osc fails without giving
the user the opportunity to continue.

This introduces a new class method `create` for the AbstractCredentialsManager.
The CredentialsManagers for the backends that use a 3rd party software can
now check if the software is present in its own create method.
2019-10-24 11:21:23 +02:00
lethliel
abf206fa0d New credentials backend (Transient store)
New backend to not store the password and ask for
it every time.
2019-08-29 15:06:45 +02:00
lethliel
eb3a3ef0ec Introduction of new credential management
* new module credentials.py which contains classes
  and methods to set and get passwords for different
  backends:
      - python-keyring
      - gnomekeyring
      - ConfigFile based storage

The new code should be backward compatible except a minor
change in add_section (pass and passx are not removed from
the config parser). This affects only callers that do not pass
a creds_mgr_descriptor.

On initial osc call or initial osc call on new API Url
the user now can decide where to store the password (based
on the backends available on his system)
2019-08-29 15:04:36 +02:00