diff --git a/ordr3/security.py b/ordr3/security.py index 34ab8ee..3540cd8 100644 --- a/ordr3/security.py +++ b/ordr3/security.py @@ -1,5 +1,6 @@ """ User Authentication and Authorization """ +from passlib import CryptContext from pyramid.security import Everyone, Authenticated from sqlalchemy.orm.exc import NoResultFound from pyramid.authorization import ACLAuthorizationPolicy @@ -40,6 +41,14 @@ def get_user(request): return None +def get_passlib_context(): + """ configures a passlib context and returns it """ + ctx = CryptContext( + schemes=["argon2", "bcrypt"], default="argon2", deprecated=["bcrypt"] + ) + return ctx + + def includeme(config): """ initializing authentication and authorization for the Pyramid app diff --git a/pyproject.toml b/pyproject.toml index 475a3e7..082bc7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ ] requires = [ - "passlib[argon2] >= 1.7.2", + "passlib[argon2,bcrypt] >= 1.7.2", "pyramid >= 1.10", "pyramid_debugtoolbar >= 4.6.1", "pyramid_jinja2 >= 2.7",