From 7c7b404e5719da4168f6191f216e0f4148300356 Mon Sep 17 00:00:00 2001 From: George Fisher Date: Fri, 15 Jul 2022 11:32:32 -0700 Subject: [PATCH 1/5] Azure Oauth Login for Redash --- client/app/assets/images/microsoft_logo.svg | 1 + .../AuthSettings/AzureLoginSettings.jsx | 49 +++++++++++++++++++ .../components/AuthSettings/index.jsx | 4 +- redash/authentication/__init__.py | 3 +- redash/cli/organization.py | 25 ++++++++++ redash/cli/users.py | 25 ++++++++-- redash/handlers/authentication.py | 20 +++++++- redash/handlers/settings.py | 4 ++ redash/models/organizations.py | 5 ++ redash/settings/__init__.py | 5 ++ redash/templates/invite.html | 11 ++++- redash/templates/login.html | 9 +++- tests/handlers/test_settings.py | 20 ++++++++ tests/test_authentication.py | 41 ++++++++++++++++ 14 files changed, 211 insertions(+), 11 deletions(-) create mode 100644 client/app/assets/images/microsoft_logo.svg create mode 100644 client/app/pages/settings/components/AuthSettings/AzureLoginSettings.jsx diff --git a/client/app/assets/images/microsoft_logo.svg b/client/app/assets/images/microsoft_logo.svg new file mode 100644 index 0000000000..1f73976483 --- /dev/null +++ b/client/app/assets/images/microsoft_logo.svg @@ -0,0 +1 @@ +MS-SymbolLockup \ No newline at end of file diff --git a/client/app/pages/settings/components/AuthSettings/AzureLoginSettings.jsx b/client/app/pages/settings/components/AuthSettings/AzureLoginSettings.jsx new file mode 100644 index 0000000000..abeee43e1b --- /dev/null +++ b/client/app/pages/settings/components/AuthSettings/AzureLoginSettings.jsx @@ -0,0 +1,49 @@ +import { isEmpty, join } from "lodash"; +import React from "react"; +import Form from "antd/lib/form"; +import Select from "antd/lib/select"; +import Alert from "antd/lib/alert"; +import DynamicComponent from "@/components/DynamicComponent"; +import { clientConfig } from "@/services/auth"; +import { SettingsEditorPropTypes, SettingsEditorDefaultProps } from "../prop-types"; + +export default function AzureLoginSettings(props) { + const { values, onChange } = props; + + if (!clientConfig.azureLoginEnabled) { + return ( +

+ azure login enabled {clientConfig.azureLoginEnabled} +

+ ); + } + + return ( + +

Microsoft Work or School Account Login

+ +