Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

auth: Fix up AzureAD Oauth2 docs and config.

Mateusz Mandera16829bd84ba8
diff --git a/docs/overview/changelog.md b/docs/overview/changelog.md
index 5d1fd5ed426..de8bb0742c0 100644
--- a/docs/overview/changelog.md
+++ b/docs/overview/changelog.md
@@ -96,7 +96,11 @@ log][commit-log] for an up-to-date list of raw changes.
#### Upgrade notes for 6.0
-- None yet.
+- Installations using the AzureAD authentication backend will need to
+ update `/etc/zulip/zulip-secrets.conf` after upgrading. The
+ `azure_oauth2_secret` secret was renamed to
+ `social_auth_azuread_oauth2_secret`, to match our other external
+ authentication methods.
## Zulip 5.x series
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py
index a03362f69a2..ba38228e3f0 100644
--- a/zproject/computed_settings.py
+++ b/zproject/computed_settings.py
@@ -1120,6 +1120,8 @@ else:
SOCIAL_AUTH_GITHUB_SECRET = get_secret("social_auth_github_secret")
SOCIAL_AUTH_GITLAB_SECRET = get_secret("social_auth_gitlab_secret")
+SOCIAL_AUTH_AZUREAD_OAUTH2_SECRET = get_secret("social_auth_azuread_oauth2_secret")
+
SOCIAL_AUTH_GITHUB_SCOPE = ["user:email"]
if SOCIAL_AUTH_GITHUB_ORG_NAME or SOCIAL_AUTH_GITHUB_TEAM_ID:
SOCIAL_AUTH_GITHUB_SCOPE.append("read:org")
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index 89e33428b50..46025fe9b38 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -76,7 +76,7 @@ SOCIAL_AUTH_GITHUB_ORG_NAME: Optional[str] = None
SOCIAL_AUTH_GITHUB_TEAM_ID: Optional[str] = None
SOCIAL_AUTH_GITLAB_KEY = get_secret("social_auth_gitlab_key", development_only=True)
SOCIAL_AUTH_SUBDOMAIN: Optional[str] = None
-SOCIAL_AUTH_AZUREAD_OAUTH2_SECRET = get_secret("azure_oauth2_secret")
+SOCIAL_AUTH_AZUREAD_OAUTH2_KEY = get_secret("social_auth_azuread_oauth2_key", development_only=True)
SOCIAL_AUTH_GOOGLE_KEY = get_secret("social_auth_google_key", development_only=True)
# SAML:
SOCIAL_AUTH_SAML_SP_ENTITY_ID: Optional[str] = None
diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py
index 29d62a755d9..49fbbf3ae6a 100644
--- a/zproject/prod_settings_template.py
+++ b/zproject/prod_settings_template.py
@@ -509,15 +509,19 @@ SOCIAL_AUTH_SAML_SUPPORT_CONTACT = {
##
## To set up Microsoft Azure AD authentication, you'll need to do the following:
##
-## (1) Register an OAuth2 application with Microsoft at:
-## https://apps.dev.microsoft.com
-## Generate a new password under Application Secrets
-## Generate a new platform (web) under Platforms. For Redirect URL, enter:
-## https://zulip.example.com/complete/azuread-oauth2/
-## Add User.Read permission under Microsoft Graph Permissions
-##
-## (2) Enter the application ID for the app as SOCIAL_AUTH_AZUREAD_OAUTH2_KEY here
-## (3) Put the application password in zulip-secrets.conf as 'azure_oauth2_secret'.
+## (1) Open "App registrations" at
+## https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
+## and click "New registration".
+##
+## (2) In the "Redirect URI (optional)" section, select Web as the platform
+## and enter https://zulip.example.com/complete/azuread-oauth2/ as the redirect URI,
+## based on your values of EXTERNAL_HOST and SOCIAL_AUTH_SUBDOMAIN.
+##
+## (3) After registering the app, go to "Certificates & secrets" and
+## generate a new client secret. Make sure to save the generated Value.
+##
+## (4) Enter the application ID for the app as SOCIAL_AUTH_AZUREAD_OAUTH2_KEY below
+## and the generated secret Value in zulip-secrets.conf as `social_auth_azuread_oauth2_secret`.
# SOCIAL_AUTH_AZUREAD_OAUTH2_KEY = ""
########