mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add multi-factor authentication modules (#15489)
* Get user after login flow finished * Add multi factor authentication support * Typings
This commit is contained in:
committed by
Paulus Schoutsen
parent
ae63980152
commit
7e7f9bc6ac
@@ -14,14 +14,16 @@ import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
from homeassistant import auth
|
||||
from homeassistant.auth import providers as auth_providers
|
||||
from homeassistant.auth import providers as auth_providers,\
|
||||
mfa_modules as auth_mfa_modules
|
||||
from homeassistant.const import (
|
||||
ATTR_FRIENDLY_NAME, ATTR_HIDDEN, ATTR_ASSUMED_STATE,
|
||||
CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, CONF_PACKAGES, CONF_UNIT_SYSTEM,
|
||||
CONF_TIME_ZONE, CONF_ELEVATION, CONF_UNIT_SYSTEM_METRIC,
|
||||
CONF_UNIT_SYSTEM_IMPERIAL, CONF_TEMPERATURE_UNIT, TEMP_CELSIUS,
|
||||
__version__, CONF_CUSTOMIZE, CONF_CUSTOMIZE_DOMAIN, CONF_CUSTOMIZE_GLOB,
|
||||
CONF_WHITELIST_EXTERNAL_DIRS, CONF_AUTH_PROVIDERS, CONF_TYPE)
|
||||
CONF_WHITELIST_EXTERNAL_DIRS, CONF_AUTH_PROVIDERS, CONF_AUTH_MFA_MODULES,
|
||||
CONF_TYPE)
|
||||
from homeassistant.core import callback, DOMAIN as CONF_CORE, HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.loader import get_component, get_platform
|
||||
@@ -166,7 +168,10 @@ CORE_CONFIG_SCHEMA = CUSTOMIZE_CONFIG_SCHEMA.extend({
|
||||
CONF_TYPE: vol.NotIn(['insecure_example'],
|
||||
'The insecure_example auth provider'
|
||||
' is for testing only.')
|
||||
})])
|
||||
})]),
|
||||
vol.Optional(CONF_AUTH_MFA_MODULES):
|
||||
vol.All(cv.ensure_list,
|
||||
[auth_mfa_modules.MULTI_FACTOR_AUTH_MODULE_SCHEMA]),
|
||||
})
|
||||
|
||||
|
||||
@@ -412,7 +417,9 @@ async def async_process_ha_core_config(
|
||||
# Only load auth during startup.
|
||||
if not hasattr(hass, 'auth'):
|
||||
setattr(hass, 'auth', await auth.auth_manager_from_config(
|
||||
hass, config.get(CONF_AUTH_PROVIDERS, [])))
|
||||
hass,
|
||||
config.get(CONF_AUTH_PROVIDERS, []),
|
||||
config.get(CONF_AUTH_MFA_MODULES, [])))
|
||||
|
||||
hac = hass.config
|
||||
|
||||
|
||||
Reference in New Issue
Block a user