chore(oauth2): fix query function exports
This commit is contained in:
parent
c9f1bc4047
commit
5c4042e5f3
@ -11,6 +11,8 @@ module Auth.OAuth2
|
|||||||
, AzureUserException(..), _AzureUserError, _AzureUserNoResult, _AzureUserAmbiguous
|
, AzureUserException(..), _AzureUserError, _AzureUserNoResult, _AzureUserAmbiguous
|
||||||
, apAzureMock
|
, apAzureMock
|
||||||
, azureMockServer
|
, azureMockServer
|
||||||
|
, queryOAuth2User
|
||||||
|
, refreshOAuth2Token
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.CaseInsensitive as CI
|
import qualified Data.CaseInsensitive as CI
|
||||||
@ -103,7 +105,7 @@ azureMockServer port =
|
|||||||
}
|
}
|
||||||
mockServerURL = "http://localhost:" <> fromString port
|
mockServerURL = "http://localhost:" <> fromString port
|
||||||
profileSrc = fromString $ mockServerURL <> "/users/me"
|
profileSrc = fromString $ mockServerURL <> "/users/me"
|
||||||
in authOAuth2 mockPluginName oa $ \manager token -> do
|
in authOAuth2 apAzureMock oa $ \manager token -> do
|
||||||
(UserID userID, userResponse) <- authGetProfile apAzureMock manager token profileSrc
|
(UserID userID, userResponse) <- authGetProfile apAzureMock manager token profileSrc
|
||||||
return Creds
|
return Creds
|
||||||
{ credsPlugin = apAzureMock
|
{ credsPlugin = apAzureMock
|
||||||
@ -122,8 +124,12 @@ data UserDataException = UserDataJSONException JSONException
|
|||||||
|
|
||||||
instance Exception UserDataException
|
instance Exception UserDataException
|
||||||
|
|
||||||
queryOAuth2User :: forall j m . (FromJSON j, MonadIO m, MonadThrow m, MonadHandler m)
|
queryOAuth2User :: forall j m.
|
||||||
=> Text
|
( FromJSON j
|
||||||
|
, MonadHandler m
|
||||||
|
, MonadThrow m
|
||||||
|
)
|
||||||
|
=> Text -- ^ User identifier (arbitrary needle)
|
||||||
-> m (Either UserDataException j)
|
-> m (Either UserDataException j)
|
||||||
queryOAuth2User userID = runExceptT $ do
|
queryOAuth2User userID = runExceptT $ do
|
||||||
(queryUrl, tokenUrl) <- liftIO mkBaseUrls
|
(queryUrl, tokenUrl) <- liftIO mkBaseUrls
|
||||||
@ -159,7 +165,10 @@ mkBaseUrls = do
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
refreshOAuth2Token :: forall m. (MonadIO m, MonadThrow m, MonadHandler m)
|
refreshOAuth2Token :: forall m.
|
||||||
|
( MonadHandler m
|
||||||
|
, MonadThrow m
|
||||||
|
)
|
||||||
=> (Maybe AccessToken, Maybe RefreshToken)
|
=> (Maybe AccessToken, Maybe RefreshToken)
|
||||||
-> String
|
-> String
|
||||||
-> Bool
|
-> Bool
|
||||||
|
|||||||
Reference in New Issue
Block a user