diff --git a/src/Auth/OAuth2.hs b/src/Auth/OAuth2.hs index 8450d71a9..d7cddca2b 100644 --- a/src/Auth/OAuth2.hs +++ b/src/Auth/OAuth2.hs @@ -26,7 +26,9 @@ import Import.NoFoundation hiding (pack, unpack) import Network.HTTP.Simple (httpJSONEither, getResponseBody, JSONException) +# ifdef DEVELOPMENT import System.Environment (lookupEnv) +# endif import Yesod.Auth.OAuth2 import Yesod.Auth.OAuth2.Prelude hiding (encodeUtf8) @@ -120,15 +122,15 @@ instance FromJSON UserID where azureMockServer :: YesodAuth m => String -> AuthPlugin m azureMockServer port = let oa = OAuth2 - { oauthClientId = "42" - , oauthClientSecret = Just "shhh" - , oauthOAuthorizeEndpoint = fromString (mockServerURL <> "/auth") + { oauth2ClientId = "42" + , oauth2ClientSecret = Just "shhh" + , oauth2AuthorizeEndpoint = fromString (mockServerURL <> "/auth") `withQuery` [ scopeParam " " ["openid", "profile", "email", "offline_access"] -- TODO read scopes from config , ("response_type", "code id_token") , ("nonce", "Foo") -- TODO generate meaningful value ] - , oauthAccessTokenEndpoint = fromString $ mockServerURL <> "/token" - , oauthCallback = Nothing + , oauth2TokenEndpoint = fromString $ mockServerURL <> "/token" + , oauth2RedirectUri = Nothing -- TODO use approot as redirect uri? } mockServerURL = "http://localhost:" <> fromString port profileSrc = fromString $ mockServerURL <> "/users/me"