Files
Homelabv4/infrastructure/authentik/home-assistant-blueprint.yaml
T
2026-03-09 20:21:35 -05:00

69 lines
3.0 KiB
YAML

---
# Home Assistant OIDC Provider Blueprint for Authentik
#
# This blueprint creates an OAuth2/OIDC provider in Authentik for Home Assistant
# Home Assistant will use the hass-openid custom integration for direct OIDC auth
#
# AUTOMATIC FEATURES:
# - Users authenticate via Authentik OIDC
# - User accounts auto-created in Home Assistant on first login
# - Usernames sync from Authentik (preferred_username)
# - No OAuth2 Proxy needed - direct integration!
apiVersion: v1
kind: ConfigMap
metadata:
name: authentik-blueprints-home-assistant
namespace: authentik
labels:
goauthentik.io/blueprint: "true"
data:
home-assistant.yaml: |-
version: 1
metadata:
name: home-assistant-oidc
entries:
# ============================================================================
# HOME ASSISTANT OAUTH2 PROVIDER
# ============================================================================
# Manual client_id and client_secret for full automation (no random generation)
- model: authentik_providers_oauth2.oauth2provider
id: home-assistant-provider
state: present
identifiers:
name: Home Assistant
attrs:
name: Home Assistant
client_id: ha1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab
client_secret: ha_secret_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12345678
authorization_flow: !Find [authentik_flows.flow, [slug, default-provider-authorization-implicit-consent]]
authentication_flow: !Find [authentik_flows.flow, [slug, default-authentication-flow]]
invalidation_flow: !Find [authentik_flows.flow, [slug, default-provider-invalidation-flow]]
redirect_uris:
- url: "https://homeassistant.kube.huskypup.net/auth/openid/callback"
matching_mode: strict
property_mappings:
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, openid]]
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, email]]
- !Find [authentik_providers_oauth2.scopemapping, [scope_name, profile]]
client_type: confidential
access_code_validity: "minutes=10"
access_token_validity: "hours=1"
refresh_token_validity: "days=30"
signing_key: !Find [authentik_crypto.certificatekeypair, [name, "authentik Internal JWT Certificate"]]
# ============================================================================
# HOME ASSISTANT APPLICATION
# ============================================================================
- model: authentik_core.application
id: home-assistant-application
state: present
identifiers:
slug: home-assistant
attrs:
name: Home Assistant
slug: home-assistant
policy_engine_mode: any
provider: !KeyOf home-assistant-provider