Files
enterprise_digital-platform/IT_asset_management/app/routes/auth.py
T

19 lines
588 B
Python

from flask import Blueprint, redirect, url_for, current_app
from flask_login import logout_user, login_required
bp = Blueprint('auth', __name__)
@bp.route('/login', methods=['GET', 'POST'])
def login():
# Authentication is handled by the EDP portal via nginx SSO.
# Redirect any direct login attempts to the portal.
return redirect(current_app.config.get('PORTAL_LOGIN_URL', 'http://localhost:8080/login'))
@bp.route('/logout')
@login_required
def logout():
logout_user()
return redirect(current_app.config.get('PORTAL_LOGIN_URL', 'http://localhost:8080/login'))