fix(oauth2): use azureadv2 instead of v1 plugin

This commit is contained in:
Sarah Vaupel 2024-05-16 17:01:25 +02:00
parent 6693bbe166
commit 064b2879ad

View File

@ -101,7 +101,7 @@ import UnliftIO.Pool
import qualified Web.ServerSession.Backend.Acid as Acid
import Web.ServerSession.Core (StorageException(..))
import Yesod.Auth.OAuth2.AzureAD (oauth2AzureADScoped)
import Yesod.Auth.OAuth2.AzureADv2 (oauth2AzureADv2Scoped)
import Yesod.Auth.Util.PasswordStore
import qualified Yesod.Core.Types as Yesod (Logger(..))
@ -328,7 +328,7 @@ makeFoundation appSettings''@AppSettings{..} = do
#ifdef DEVELOPMENT
oauth2Plugins <- liftIO $ sequence
[ (azureMockServer . fromJust) <$> lookupEnv "OAUTH2_SERVER_PORT"
, return $ oauth2AzureADScoped ["openid", "profile", "offline_access"] "42" "shhh"
, return $ oauth2AzureADv2Scoped ["openid", "profile", "offline_access"] "42" "shhh"
]
#else
let -- Auth Plugins
@ -345,7 +345,7 @@ makeFoundation appSettings''@AppSettings{..} = do
-- -> error "Tenant ID missing!"
oauth2Plugins
| UserAuthConfSingleSource (AuthSourceConfAzureAdV2 AzureConf{..}) <- appUserAuthConf
= singleton $ oauth2AzureADScoped (Set.toList azureConfScopes) (tshow azureConfClientId) azureConfClientSecret
= singleton $ oauth2AzureADv2Scoped (Set.toList azureConfScopes) (tshow azureConfClientId) azureConfClientSecret
| otherwise
= mempty
#endif