Returns the dict for the authentication methods, registered for the current user, among the list of supported. Returns: dict: dict for the auth methods
()
| 100 | |
| 101 | |
| 102 | def 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 | |
| 127 | def is_mfa_session_authenticated() -> bool: |