Skip to main content

SSO (Single sign-on)

This reference document describes the available SSO protocols, configuration options, and parameters in Infrahub.

Supported protocols​

info

See Authentication topic for details on the differences between OIDC and OAuth2.

OpenID Connect (OIDC)​

OIDC is an identity layer built on top of OAuth 2.0 that standardizes user authentication and identity information exchange.

OAuth 2.0​

OAuth 2.0 is an industry-standard protocol for authorization that focuses on client developer simplicity.

Configuration slots​

Infrahub provides six predefined configuration slots for identity providers:

ProtocolAvailable Slots
OIDCPROVIDER1, PROVIDER2, GOOGLE
OAuth 2.0PROVIDER1, PROVIDER2, GOOGLE
info

The Google provider configuration is simplified compared to standard providers. It only requires client_id and client_secret parameters, as the other endpoints are pre-configured. Otherwise, the functionality is identical to standard providers.

Configuration parameters​

OIDC parameters​

ParameterEnvironment VariableTOML PathDescriptionRequired
Client IDINFRAHUB_OIDC_<SLOT>_CLIENT_IDsecurity.oidc_provider_settings.<slot>.client_idThe client identifier issued to the client by the identity providerYes
Client SecretINFRAHUB_OIDC_<SLOT>_CLIENT_SECRETsecurity.oidc_provider_settings.<slot>.client_secretThe client secret issued to the client by the identity providerNo
Discovery URLINFRAHUB_OIDC_<SLOT>_DISCOVERY_URLsecurity.oidc_provider_settings.<slot>.discovery_urlThe URL of the OIDC discovery documentYes
PKCEINFRAHUB_OIDC_<SLOT>_PKCE_ENABLEDsecurity.oidc_provider_settings.<slot>.pkce_enabledIndicates if PKCE is enabledNo
Verify id_token signatureINFRAHUB_OIDC_<SLOT>_ID_TOKEN_VERIFY_SIGNATUREsecurity.oidc_provider_settings.<slot>.id_token_verify_signatureVerify the cryptographic signature, audience and issuer of the OIDC id_token. Defaults to true; disable only for a misconfigured providerNo
Display LabelINFRAHUB_OIDC_<SLOT>_DISPLAY_LABELsecurity.oidc_provider_settings.<slot>.display_labelThe label displayed on the login buttonNo
IconINFRAHUB_OIDC_<SLOT>_ICONsecurity.oidc_provider_settings.<slot>.iconThe Material Design icon name to display on the login buttonNo
Enabled ProvidersINFRAHUB_SECURITY_OIDC_PROVIDERSsecurity.oidc_providersArray of enabled OIDC provider slotsYes*

*At least one provider must be specified if using OIDC.

OAuth 2.0 parameters​

ParameterEnvironment VariableTOML PathDescriptionRequired
Client IDINFRAHUB_OAUTH2_<SLOT>_CLIENT_IDsecurity.oauth2_provider_settings.<slot>.client_idThe client identifier issued to the client by the identity providerYes
Client SecretINFRAHUB_OAUTH2_<SLOT>_CLIENT_SECRETsecurity.oauth2_provider_settings.<slot>.client_secretThe client secret issued to the client by the identity providerNo
Authorization URLINFRAHUB_OAUTH2_<SLOT>_AUTHORIZATION_URLsecurity.oauth2_provider_settings.<slot>.authorization_urlThe authorization endpoint URLYes
Token URLINFRAHUB_OAUTH2_<SLOT>_TOKEN_URLsecurity.oauth2_provider_settings.<slot>.token_urlThe token endpoint URLYes
Userinfo URLINFRAHUB_OAUTH2_<SLOT>_USERINFO_URLsecurity.oauth2_provider_settings.<slot>.userinfo_urlThe userinfo endpoint URLYes
PKCEINFRAHUB_OAUTH2_<SLOT>_PKCE_ENABLEDsecurity.oauth2_provider_settings.<slot>.pkce_enabledIndicates if PKCE is enabledNo
Display LabelINFRAHUB_OAUTH2_<SLOT>_DISPLAY_LABELsecurity.oauth2_provider_settings.<slot>.display_labelThe label displayed on the login buttonNo
IconINFRAHUB_OAUTH2_<SLOT>_ICONsecurity.oauth2_provider_settings.<slot>.iconThe Material Design icon name to display on the login buttonNo
Enabled ProvidersINFRAHUB_SECURITY_OAUTH2_PROVIDERSsecurity.oauth2_providersArray of enabled OAuth 2.0 provider slotsYes*

*At least one provider must be specified if using OAuth 2.0.

Redirect URI formats​

When configuring a provider in an external identity system, use the following format for the redirect URI:

https://<your-infrahub-hostname>/auth/<protocol>/<provider-slot>/callback
ProtocolFormat Example
OIDChttps://infrahub.example.com/auth/oidc/provider1/callback
OAuth 2.0https://infrahub.example.com/auth/oauth2/provider1/callback

User attributes mapping​

Infrahub maps the following claims from identity providers to its internal user model:

Infrahub FieldOIDC ClaimOAuth 2.0 FieldNotes
Identity anchorsubsubProvider-issued subject identifier; used to resolve accounts across logins. Requires the openid scope.
Account namenamenameUsed as the account name on creation. If name is already claimed by another SSO user, email is used instead.
Display labelnamenameSynced on every login.

Account name fallback​

On a user's first SSO login (before an identity is linked), Infrahub can adopt a pre-existing account whose name matches the provider's display name, as long as that account has never been linked to another identity. This eases upgrades where local accounts already exist.

ParameterEnvironment VariableTOML PathDescriptionDefault
Account name fallbackINFRAHUB_SECURITY_SSO_ACCOUNT_NAME_FALLBACKsecurity.sso_account_name_fallbackAllow a first-time SSO login to adopt a pre-existing account that matches by display name. When disabled, such a login always provisions a separate account.true
warning

This fallback is a transitional convenience and is deprecated; it will be removed in a future release. Once all SSO users have completed their first login, set INFRAHUB_SECURITY_SSO_ACCOUNT_NAME_FALLBACK=false as a hardening step so that accounts are resolved only by the immutable sub identity anchor.

Examples​

OIDC configuration example​

[security.oidc_provider_settings.provider1]
client_id = "client-id-from-idp"
client_secret = "client-secret-from-idp"
discovery_url = "https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration"
display_label = "Microsoft Entra ID"
icon = "mdi:microsoft"

[security]
oidc_providers = ["provider1"]

OAuth 2.0 configuration example​

[security.oauth2_provider_settings.provider1]
client_id = "client-id-from-idp"
client_secret = "client-secret-from-idp"
authorization_url = "https://login.microsoftonline.com/tenant-id/oauth2/v2.0/authorize"
token_url = "https://login.microsoftonline.com/tenant-id/oauth2/v2.0/token"
userinfo_url = "https://graph.microsoft.com/oidc/userinfo"
display_label = "Microsoft Entra ID"
icon = "mdi:microsoft"

[security]
oauth2_providers = ["provider1"]