Add basic provider to test frontend parts

This commit is contained in:
Christiaan Goossens
2022-11-29 08:10:40 +01:00
parent 9fc8278724
commit 397f5ea79c
6 changed files with 233 additions and 123 deletions

View File

@@ -4,28 +4,35 @@ from typing import OrderedDict
import voluptuous as vol
from homeassistant.core import HomeAssistant
from .example import ExampleAuthProvider
DOMAIN = "auth_oidc"
_LOGGER = logging.getLogger(__name__)
from .provider import OpenIDAuthProvider
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
}
)
},
extra=vol.ALLOW_EXTRA,
)
async def async_setup(hass: HomeAssistant, config):
"""TODO"""
# Inject Auth-Header provider.
"""Add the OIDC Auth Provider to the providers in Home Assistant"""
providers = OrderedDict()
provider = ExampleAuthProvider(
provider = OpenIDAuthProvider(
hass,
hass.auth._store,
config[DOMAIN],
)
providers[(provider.type, provider.id)] = provider
providers.update(hass.auth._providers)
hass.auth._providers = providers
_LOGGER.debug("Injected example provider")
return True
_LOGGER.debug("Added OIDC provider")
return True