MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / user_supported_mfa_methods

Function user_supported_mfa_methods

web/pgadmin/authenticate/mfa/utils.py:102–124  ·  view source on GitHub ↗

Returns the dict for the authentication methods, registered for the current user, among the list of supported. Returns: dict: dict for the auth methods

()

Source from the content-addressed store, hash-verified

100
101
102def user_supported_mfa_methods():
103 """
104 Returns the dict for the authentication methods, registered for the
105 current user, among the list of supported.
106
107 Returns:
108 dict: dict for the auth methods
109 """
110 auths = UserMFA.query.filter_by(user_id=current_user.id).all()
111 res = dict()
112 supported_mfa_auth_methods = dict()
113
114 if len(auths) > 0:
115 for auth_method in config.MFA_SUPPORTED_METHODS:
116 registry = MultiFactorAuthRegistry.get(auth_method)
117 supported_mfa_auth_methods[registry.name] = registry
118
119 for auth in auths:
120 if auth.mfa_auth in supported_mfa_auth_methods:
121 res[auth.mfa_auth] = \
122 supported_mfa_auth_methods[auth.mfa_auth]
123
124 return res
125
126
127def is_mfa_session_authenticated() -> bool:

Callers 3

check_user_registeredFunction · 0.90
mfa_user_registeredFunction · 0.85
validate_viewFunction · 0.85

Calls 1

getMethod · 0.45

Tested by 1

check_user_registeredFunction · 0.72