Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] CredentialManager: Store passwords in System Keyring Services #1641

Merged
merged 1 commit into from
Oct 7, 2016

Conversation

nikicc
Copy link
Contributor

@nikicc nikicc commented Oct 7, 2016

Credential Manager is used for safely storing passwords in system's keyring services.

@codecov-io
Copy link

codecov-io commented Oct 7, 2016

Current coverage is 88.72% (diff: 100%)

Merging #1641 into master will not change coverage

@@             master      #1641   diff @@
==========================================
  Files            78         78          
  Lines          8148       8148          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           7229       7229          
  Misses          919        919          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 5247253...99c65fa

@nikicc nikicc changed the title CredentialManager: Store passwords in System Keyring Services [ENH] CredentialManager: Store passwords in System Keyring Services Oct 7, 2016
Copy link
Contributor

@kernc kernc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, there is a test. But a short how-to-use example in a module docstring would also be nice.

@nikicc
Copy link
Contributor Author

nikicc commented Oct 7, 2016

Short example added.

keyring.set_password(self.service_name, self.username, value)

def delete_password(self):
keyring.delete_password(self.service_name, self.username)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these methods be replaced with __setattr__, __getattr__, and __delattr__ so the supported interface becomes more like a general secure key-value store?


class CredentialManager:
def __init__(self, username):
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class docstring goes outside __init__.

username: username used for storing a matching password.

Examples:
>>> cm = CredentialManager('Foo')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cm = CredentialManager('Some Widget')


@property
def key(self):
return keyring.get_password(self.service_name, self.username)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should getter return None by default?



class CredentialManager:
def __init__(self, username):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service name (namespace), not username (key).

@nikicc nikicc force-pushed the credentials branch 6 times, most recently from b2c0129 to 7fa17a2 Compare October 7, 2016 12:53
@nikicc
Copy link
Contributor Author

nikicc commented Oct 7, 2016

@kernc please check again.

Credential Manager is used for safely storing passwords in system's keyring services.
@astaric astaric merged commit 3f82460 into biolab:master Oct 7, 2016
@nikicc nikicc deleted the credentials branch October 7, 2016 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants