|
|
@ -1,5 +1,6 @@ |
|
|
|
""" User Authentication and Authorization """ |
|
|
|
""" User Authentication and Authorization """ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from passlib import CryptContext |
|
|
|
from pyramid.security import Everyone, Authenticated |
|
|
|
from pyramid.security import Everyone, Authenticated |
|
|
|
from sqlalchemy.orm.exc import NoResultFound |
|
|
|
from sqlalchemy.orm.exc import NoResultFound |
|
|
|
from pyramid.authorization import ACLAuthorizationPolicy |
|
|
|
from pyramid.authorization import ACLAuthorizationPolicy |
|
|
@ -40,6 +41,14 @@ def get_user(request): |
|
|
|
return None |
|
|
|
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): |
|
|
|
def includeme(config): |
|
|
|
""" initializing authentication and authorization for the Pyramid app |
|
|
|
""" initializing authentication and authorization for the Pyramid app |
|
|
|
|
|
|
|
|
|
|
|