Allow for skipping the welcome screen (even if HA username/password is still registered) (#272)
* Allow for skipping the welcome screen (even if HA username/password is still registered) * Linting & formatting * Typing & tests
This commit is contained in:
committed by
GitHub
parent
f90a7d5346
commit
3ba65adc8b
@@ -28,6 +28,7 @@ from .config import (
|
||||
ROLES,
|
||||
NETWORK,
|
||||
FEATURES_INCLUDE_GROUPS_SCOPE,
|
||||
FEATURES_DEFAULT_REDIRECT,
|
||||
FEATURES_FORCE_HTTPS,
|
||||
REQUIRED_SCOPES,
|
||||
)
|
||||
@@ -43,6 +44,7 @@ from .endpoints import (
|
||||
OIDCDeviceSSE,
|
||||
)
|
||||
from .tools.oidc_client import OIDCClient
|
||||
from .tools.types import OIDCWelcomeOptions
|
||||
from .provider import OpenIDAuthProvider
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -146,6 +148,7 @@ async def _setup_oidc_provider(hass: HomeAssistant, my_config: dict, display_nam
|
||||
name = re.sub(r"[^A-Za-z0-9 _\-\(\)]", "", name)
|
||||
|
||||
force_https = features_config.get(FEATURES_FORCE_HTTPS, False)
|
||||
default_redirect = features_config.get(FEATURES_DEFAULT_REDIRECT, False)
|
||||
|
||||
await hass.http.async_register_static_paths(
|
||||
[
|
||||
@@ -158,7 +161,15 @@ async def _setup_oidc_provider(hass: HomeAssistant, my_config: dict, display_nam
|
||||
)
|
||||
|
||||
hass.http.register_view(
|
||||
OIDCWelcomeView(provider, name, force_https, has_other_auth_providers)
|
||||
OIDCWelcomeView(
|
||||
provider,
|
||||
OIDCWelcomeOptions(
|
||||
name=name,
|
||||
force_https=force_https,
|
||||
has_other_auth_providers=has_other_auth_providers,
|
||||
prefers_skipping=default_redirect,
|
||||
),
|
||||
)
|
||||
)
|
||||
hass.http.register_view(OIDCDeviceSSE(provider))
|
||||
hass.http.register_view(OIDCRedirectView(oidc_client, provider, force_https))
|
||||
|
||||
Reference in New Issue
Block a user