chore(oauth2): add debug output on azure auth plugin initialization

This commit is contained in:
Sarah Vaupel 2024-05-16 17:13:38 +02:00
parent 064b2879ad
commit 037f464418

View File

@ -331,7 +331,7 @@ makeFoundation appSettings''@AppSettings{..} = do
, return $ oauth2AzureADv2Scoped ["openid", "profile", "offline_access"] "42" "shhh"
]
#else
let -- Auth Plugins
-- let -- Auth Plugins
-- loadPlugin p prefix = do -- Loads given YesodAuthPlugin
-- mID <- fmap Text.pack <$> appUserAuthConf ^? _UserAuthConfSingleSource . _AuthSourceConfAzureAdV2 . _azureConfClientId
-- mSecret <- fmap Text.pack <$> appUserAuthConf ^? _UserAuthConfSingleSource . _AuthSourceConfAzureAdV2 . _azureConfClientSecret
@ -343,11 +343,17 @@ makeFoundation appSettings''@AppSettings{..} = do
-- -> tshow azureConfTenantId
-- _other
-- -> error "Tenant ID missing!"
oauth2Plugins
| UserAuthConfSingleSource (AuthSourceConfAzureAdV2 AzureConf{..}) <- appUserAuthConf
= singleton $ oauth2AzureADv2Scoped (Set.toList azureConfScopes) (tshow azureConfClientId) azureConfClientSecret
| otherwise
= mempty
oauth2Plugins <- if
| UserAuthConfSingleSource (AuthSourceConfAzureAdV2 AzureConf{..}) <- appUserAuthConf -> do
$logInfoS "OAuth2" "Successfully parsed OAuth2 config from AppSettings"
return . singleton $ oauth2AzureADv2Scoped (Set.toList azureConfScopes) (tshow azureConfClientId) azureConfClientSecret
| otherwise -> do
when appSingleSignOn $ do
$logErrorS "OAuth2" "SingleSignOn via AzureADv2 is enabled, but user-auth config could not be parsed!"
when appAutoSignOn $
$logErrorS "OAuth2" "SingleSignOn via AzureADv2 and AutoSignOn are enabled, but user-auth config could not be parsed! This will likely prevent the app from being accessible!"
$logInfoS "UserAuthConf" $ tshow appUserAuthConf
return mempty
#endif
let appAuthPlugins = oauth2Plugins