feat: add Azure AD single-tenant authentication support

Add support for AzureADTenantOAuth2 backend which allows restricting
authentication to a specific Azure AD tenant (organization).

Configuration:
- SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_KEY: Azure app client ID
- SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_SECRET: Azure app client secret
- SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_TENANT_ID: Azure AD Directory ID

This enables organizations to restrict Tabby Web access to only users
from their Azure AD tenant, preventing personal Microsoft accounts or
users from other organizations from logging in.

Fixes #120
This commit is contained in:
Brian Olson
2025-12-31 20:46:53 -05:00
parent 16847cea93
commit 9544e363c9
3 changed files with 37 additions and 1 deletions

View File

@@ -138,6 +138,7 @@ AUTHENTICATION_BACKENDS = (
"social_core.backends.github.GithubOAuth2",
"social_core.backends.gitlab.GitLabOAuth2",
"social_core.backends.azuread.AzureADOAuth2",
"social_core.backends.azuread_tenant.AzureADTenantOAuth2", # Single-tenant Azure AD
"social_core.backends.microsoft.MicrosoftOAuth2",
"social_core.backends.google.GoogleOAuth2",
"django.contrib.auth.backends.ModelBackend",
@@ -180,6 +181,10 @@ for key in [
"SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET",
"SOCIAL_AUTH_MICROSOFT_GRAPH_KEY",
"SOCIAL_AUTH_MICROSOFT_GRAPH_SECRET",
# Azure AD single-tenant (use instead of multi-tenant for org-only access)
"SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_KEY",
"SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_SECRET",
"SOCIAL_AUTH_AZUREAD_TENANT_OAUTH2_TENANT_ID",
"CONNECTION_GATEWAY_AUTH_CA",
"CONNECTION_GATEWAY_AUTH_CERTIFICATE",
"CONNECTION_GATEWAY_AUTH_KEY",