From 44d082f8b95ad1b2d1ee0e9ce71d84dfbcd23df4 Mon Sep 17 00:00:00 2001 From: David Mosbach Date: Sun, 3 Dec 2023 23:23:44 +0000 Subject: [PATCH] feat(auth): added azure & mock server to login widget --- src/Application.hs | 6 +++--- templates/login.hamlet | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index c6f2cb68c..8b9a21739 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -326,12 +326,12 @@ makeFoundation appSettings''@AppSettings{..} = do appPersonalisedSheetFilesSeedKey <- clusterSetting (Proxy :: Proxy 'ClusterPersonalisedSheetFilesSeedKey) `customRunSqlPool` sqlPool - mAzureTenantID <- liftIO $ (fmap Text.pack) <$> lookupEnv "AZURE_ADV2_TENANT_ID" + mAzureTenantID <- liftIO $ (fmap Text.pack) <$> (return $ Just "123") -- lookupEnv "AZURE_ADV2_TENANT_ID" let -- Auth Plugins tenantID = fromMaybe (error "Tenant ID mising") mAzureTenantID loadPlugin p prefix = do -- Loads given YesodAuthPlugin - mID <- (fmap Text.pack) <$> (lookupEnv $ prefix ++ "_CLIENT_ID") - mSecret <- (fmap Text.pack) <$> (lookupEnv $ prefix ++ "_CLIENT_SECRET") + mID <- (fmap Text.pack) <$> (return $ Just "UWX") -- (lookupEnv $ prefix ++ "_CLIENT_ID") + mSecret <- (fmap Text.pack) <$> (return $ Just prefix) -- (lookupEnv $ prefix ++ "_CLIENT_SECRET") let mArgs = (,) <$> mID <*> mSecret guard $ isJust mArgs return . uncurry p $ fromJust mArgs diff --git a/templates/login.hamlet b/templates/login.hamlet index 19539af3f..7c1483d65 100644 --- a/templates/login.hamlet +++ b/templates/login.hamlet @@ -5,7 +5,15 @@ $# $# SPDX-License-Identifier: AGPL-3.0-or-later $forall AuthPlugin{apName, apLogin} <- plugins - $if apName == "LDAP" + $if apName == "azureadv2" +
+

Azure + ^{apLogin toParent} + $elseif apName == "uniworx_dev" +
+

_{MsgDummyLoginTitle} + ^{apLogin toParent} + $elseif apName == "LDAP"

_{MsgLDAPLoginTitle} ^{apLogin toParent}