arxiv.users.auth package¶
Provides tools for working with authenticated user/client sessions.
-
class
arxiv.users.auth.
Auth
(app=None)[source]¶ Bases:
object
Attaches session and authn/z information to the request.
Intended for use in a Flask application factory, for example:
from flask import Flask from arxiv.users.auth import Auth from someapp import routes def create_web_app() -> Flask: app = Flask('someapp') app.config.from_pyfile('config.py') Auth(app) # Registers the base/UI blueprint. app.register_blueprint(routes.blueprint) # Your blueprint. return app
-
init_app
(app)[source]¶ Attach
load_session()
to the Flask app.Parameters: app ( Flask
) –Return type: None
-
load_session
()[source]¶ Look for an active session, and attach it to the request.
The typical scenario will involve the
middleware.AuthMiddleware
unpacking a session token and adding it to the WSGI request environ. As a fallback, if the legacy database is available, this method will also attempt to load an active legacy session.Return type: None
-