diff --git a/app/app.py b/app/app.py index 99352e4..d0c172d 100644 --- a/app/app.py +++ b/app/app.py @@ -27,9 +27,8 @@ from app.env import db from pypnusershub.db.models import Application -from pypnusershub.login_manager import login_manager from app.utils.errors import handle_unauthenticated_request - +from pypnusershub.auth import auth_manager migrate = Migrate() @@ -63,10 +62,18 @@ def create_app(): app.config["URL_REDIRECT"] = "{}/{}".format(app.config["URL_APPLICATION"], "login") app.secret_key = app.config["SECRET_KEY"] app.wsgi_app = ProxyFix(app.wsgi_app, x_host=1) - login_manager.init_app(app) - login_manager.login_view = "login.login" db.init_app(app) app.config["DB"] = db + providers_config = [ + { + "module": "pypnusershub.auth.providers.default.LocalProvider", + "id_provider": "local_provider", + }, + ] + auth_manager.init_app( + app, prefix="/pypn/auth/", providers_declaration=providers_config + ) + auth_manager.home_page = app.config["URL_APPLICATION"] migrate.init_app(app, db, directory=Path(__file__).absolute().parent / "migrations") @@ -92,10 +99,6 @@ def constants_js(): def inject_user(): return dict(user=getattr(g, "user", None)) - from pypnusershub import routes - - app.register_blueprint(routes.routes, url_prefix="/pypn/auth") - from app.t_roles import route app.register_blueprint(route.route, url_prefix="/") diff --git a/dependencies/UsersHub-authentification-module b/dependencies/UsersHub-authentification-module index 63c8e2a..e27573a 160000 --- a/dependencies/UsersHub-authentification-module +++ b/dependencies/UsersHub-authentification-module @@ -1 +1 @@ -Subproject commit 63c8e2a6498315e66fa5f90bdd64ab6018e20d24 +Subproject commit e27573a9d12e116ef91b1211d6cf9451ccd1aae7 diff --git a/requirements-dependencies.in b/requirements-dependencies.in index ee80cad..803b050 100644 --- a/requirements-dependencies.in +++ b/requirements-dependencies.in @@ -1 +1 @@ -pypnusershub>=2.1.4,<3.0.0 +pypnusershub>=3.0.0,<4.0.0 diff --git a/requirements-dev.txt b/requirements-dev.txt index f5094ef..39a3ccd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -124,9 +124,7 @@ sqlalchemy==1.4.52 # pypnusershub # utils-flask-sqlalchemy typing-extensions==4.11.0 - # via - # alembic - # sqlalchemy + # via alembic urllib3==2.2.1 # via requests utils-flask-sqlalchemy==0.4.1 @@ -144,5 +142,7 @@ wtforms==3.1.2 # wtforms-components wtforms-components==0.10.5 # via -r requirements-common.in +xmltodict==0.13.0 + # via pypnusershub zipp==3.18.2 # via importlib-metadata diff --git a/requirements.txt b/requirements.txt index e14c68e..3f1cf78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -102,7 +102,7 @@ psycopg2==2.9.9 # pypnusershub pycparser==2.22 # via cffi -pypnusershub==2.1.4 +pypnusershub==3.0.0 # via -r requirements-dependencies.in python-dateutil==2.9.0.post0 # via @@ -124,9 +124,7 @@ sqlalchemy==1.4.52 # pypnusershub # utils-flask-sqlalchemy typing-extensions==4.11.0 - # via - # alembic - # sqlalchemy + # via alembic urllib3==2.2.1 # via requests utils-flask-sqlalchemy==0.4.1 @@ -144,5 +142,7 @@ wtforms==3.1.2 # wtforms-components wtforms-components==0.10.5 # via -r requirements-common.in +xmltodict==0.13.0 + # via pypnusershub zipp==3.18.2 # via importlib-metadata