Commit 06139f33 authored by ale's avatar ale

Only enable OTP if the auth backend supports it.

parent e7e13f13
......@@ -25,6 +25,9 @@
class AuthBase(object):
"""Base class for an authentication provider."""
# Set to True if this auth provider supports 2FA (via OTP tokens).
supports_otp = False
def __init__(self, config):
self.config = config
......
......@@ -86,7 +86,8 @@ class LoginService(object):
__import__(config['SSO_AUTH_MODULE'])
self.auth = sys.modules[config['SSO_AUTH_MODULE']].Auth(config)
self.enable_otp = config.get('SSO_ENABLE_OTP', False)
self.enable_otp = (config.get('SSO_ENABLE_OTP', False)
and self.auth.supports_otp)
# Run a sanity check before returning.
self._sanity_check()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment