diff options
author | Donald Stufft <donald@stufft.io> | 2013-02-12 00:43:17 -0500 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2013-02-12 00:43:17 -0500 |
commit | 622d5b0defc2c08e58a5544c0423cc7d98538cf3 (patch) | |
tree | 6780721d5cef359ccee4ab53a51bda6834cd3d6b /config.py | |
parent | 22e57b4405e4a94810d472b89fddad1b3b26f91e (diff) | |
download | decorator-622d5b0defc2c08e58a5544c0423cc7d98538cf3.tar.gz |
Rewrite password hashing to utilize passlib + bcrypt
* Upon logging in the existing unsalted sha1 passwords will be
upgraded to bcrypt
* PyPI will prefer using cookie auth to prevent needing to do
bcrypt on every request
* Load passlib configuration from the existing config.ini file
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1,6 +1,9 @@ import ConfigParser from urlparse import urlsplit, urlunsplit +from passlib.context import CryptContext + + class Config: ''' Read in the config and set up the vars with the correct type. ''' @@ -61,6 +64,15 @@ class Config: self.sentry_dsn = c.get('sentry', 'dsn') + self.passlib = CryptContext( + # Unless we've manually specific a list of deprecated + # algorithms assume we will deprecate all but the default. + deprecated=["auto"], + ) + + # Configure a passlib context from the config file + self.passlib.load_path(configfile, update=True) + def make_https(self): if self.url.startswith("http:"): self.url = "https"+self.url[4:] |