mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-08 20:18:28 -05:00
Added support for Two-factor authentication for improving security. Fixes #6543
This commit is contained in:
committed by
Akshay Joshi
parent
c4db223a64
commit
787a441343
@@ -19,7 +19,7 @@ from flask_security.views import _security
|
||||
from flask_security.utils import get_post_logout_redirect, \
|
||||
get_post_login_redirect, logout_user
|
||||
|
||||
from pgadmin import db, User
|
||||
from pgadmin.model import db, User
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils.constants import KERBEROS, INTERNAL, OAUTH2, LDAP
|
||||
from pgadmin.authenticate.registry import AuthSourceRegistry
|
||||
@@ -27,6 +27,26 @@ from pgadmin.authenticate.registry import AuthSourceRegistry
|
||||
MODULE_NAME = 'authenticate'
|
||||
auth_obj = None
|
||||
|
||||
_URL_WITH_NEXT_PARAM = "{0}?next={1}"
|
||||
|
||||
|
||||
def get_logout_url() -> str:
|
||||
"""
|
||||
Returns the logout url based on the current authentication method.
|
||||
|
||||
Returns:
|
||||
str: logout url
|
||||
"""
|
||||
BROWSER_INDEX = 'browser.index'
|
||||
if config.SERVER_MODE and\
|
||||
session['auth_source_manager']['current_source'] == \
|
||||
KERBEROS:
|
||||
return _URL_WITH_NEXT_PARAM.format(url_for(
|
||||
'authenticate.kerberos_logout'), url_for(BROWSER_INDEX))
|
||||
|
||||
return _URL_WITH_NEXT_PARAM.format(
|
||||
url_for('security.logout'), url_for(BROWSER_INDEX))
|
||||
|
||||
|
||||
class AuthenticateModule(PgAdminModule):
|
||||
def get_exposed_url_endpoints(self):
|
||||
|
||||
Reference in New Issue
Block a user