From ef3afa9a2a93ec836c6f694b68643da24f5575fe Mon Sep 17 00:00:00 2001 From: Marco Zocca Date: Tue, 31 Oct 2023 12:31:21 +0100 Subject: [PATCH] fixes --- ms-auth/src/Network/OAuth2/Provider/AzureAD.hs | 17 +++++------------ .../MSAzureAPI/StorageServices/FileService.hs | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ms-auth/src/Network/OAuth2/Provider/AzureAD.hs b/ms-auth/src/Network/OAuth2/Provider/AzureAD.hs index 9e1c15c..671ce25 100644 --- a/ms-auth/src/Network/OAuth2/Provider/AzureAD.hs +++ b/ms-auth/src/Network/OAuth2/Provider/AzureAD.hs @@ -93,6 +93,8 @@ instance Show AzureADException where -- -- -- Throws 'AzureADException' if @AZURE_CLIENT_ID@ and/or @AZURE_CLIENT_SECRET@ credentials are not found in the environment +-- +-- for scopes refer to https://learn.microsoft.com/EN-US/azure/active-directory/develop/scopes-oidc#openid-connect-scopes azureADApp :: MonadIO m => TL.Text -- ^ application name -> [Scope] -- ^ scopes @@ -100,21 +102,12 @@ azureADApp :: MonadIO m => azureADApp appname scopes = do clid <- envClientId sec <- envClientSecret - pure $ defaultAzureADApp{ - idpAppName = appname - , idpAppClientId = clid + pure $ ClientCredentialsIDPAppConfig + { idpAppClientId = clid , idpAppClientSecret = sec , idpAppScope = Set.fromList (scopes <> ["offline_access"]) - } - -defaultAzureADApp :: IdpApplication 'ClientCredentials AzureAD -defaultAzureADApp = - ClientCredentialsIDPAppConfig - { idpAppClientId = "" - , idpAppClientSecret = "" - , idpAppScope = Set.fromList ["offline_access"] -- https://learn.microsoft.com/EN-US/azure/active-directory/develop/scopes-oidc#openid-connect-scopes , idpAppTokenRequestExtraParams = Map.empty - , idpAppName = "default-azure-app" -- + , idpAppName = appname , idp = defaultAzureADIdp } diff --git a/ms-azure-api/src/MSAzureAPI/StorageServices/FileService.hs b/ms-azure-api/src/MSAzureAPI/StorageServices/FileService.hs index b5d5591..ac791ad 100644 --- a/ms-azure-api/src/MSAzureAPI/StorageServices/FileService.hs +++ b/ms-azure-api/src/MSAzureAPI/StorageServices/FileService.hs @@ -203,7 +203,7 @@ listDirectoriesP = do pure (DirItems es nm) enumResultsIgnore :: XB.Parser () -enumResultsIgnore = ignoreList ["Marker", "Prefix", "MaxResults", "DirectoryId"] +enumResultsIgnore = ignoreList ["Marker", "Prefix", "MaxResults", "DirectoryId"] -- marker :: XB.Parser (Maybe Text) -- marker = optional (TL.toStrict <$> tag "Marker" anystring)