chore: use previous oauth2 lib
This commit is contained in:
parent
7e33d9e5de
commit
8be3e2ea78
@ -61,7 +61,7 @@ import Jobs
|
||||
|
||||
import qualified Data.Text.Encoding as Text
|
||||
|
||||
import Yesod.Auth.OAuth2.AzureADv2 (oauth2AzureADv2Scoped)
|
||||
import Yesod.Auth.OAuth2.AzureAD (oauth2AzureADScoped)
|
||||
import Yesod.Auth.Util.PasswordStore
|
||||
|
||||
import qualified Data.ByteString.Lazy as LBS
|
||||
@ -349,7 +349,7 @@ makeFoundation appSettings''@AppSettings{..} = do
|
||||
#ifdef DEVELOPMENT
|
||||
oauth2Plugins <- liftIO $ sequence
|
||||
[ (azureMockServer . fromJust) <$> lookupEnv "OAUTH2_SERVER_PORT"
|
||||
, return $ oauth2AzureADv2Scoped ["openid", "profile", "offline_access"] "42" "42" "shhh"
|
||||
, return $ oauth2AzureADScoped ["openid", "profile", "offline_access"] "42" "shhh"
|
||||
]
|
||||
#else
|
||||
let -- Auth Plugins
|
||||
@ -366,7 +366,7 @@ makeFoundation appSettings''@AppSettings{..} = do
|
||||
-> error "Tenant ID missing!"
|
||||
oauth2Plugins
|
||||
| UserAuthConfSingleSource (AuthSourceConfAzure AzureConf{..}) appUserAuthConf
|
||||
-> singleton $ oauth2AzureADv2Scoped (Set.toList azureConfScopes) azureConfTenantId azureConfClientId azureConfClientSecret
|
||||
-> singleton $ oauth2AzureADScoped (Set.toList azureConfScopes) azureConfTenantId azureConfClientId azureConfClientSecret
|
||||
| otherwise
|
||||
-> mempty
|
||||
#endif
|
||||
|
||||
@ -118,15 +118,15 @@ instance FromJSON UserID where
|
||||
azureMockServer :: YesodAuth m => String -> AuthPlugin m
|
||||
azureMockServer port =
|
||||
let oa = OAuth2
|
||||
{ oauth2ClientId = "42"
|
||||
, oauth2ClientSecret = Just "shhh"
|
||||
, oauth2AuthorizeEndpoint = fromString (mockServerURL <> "/auth")
|
||||
{ oauthClientId = "42"
|
||||
, oauthClientSecret = Just "shhh"
|
||||
, oauthOAuthorizeEndpoint = 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
|
||||
]
|
||||
, oauth2TokenEndpoint = fromString $ mockServerURL <> "/token"
|
||||
, oauth2RedirectUri = Nothing
|
||||
, oauthAccessTokenEndpoint = fromString $ mockServerURL <> "/token"
|
||||
, oauthCallback = Nothing
|
||||
}
|
||||
mockServerURL = "http://localhost:" <> fromString port
|
||||
profileSrc = fromString $ mockServerURL <> "/users/me"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user