chore(auth): connect azure user lookup
This commit is contained in:
parent
42ecc91c22
commit
bee135ab48
@ -57,23 +57,21 @@ azureUserPreferredLanguage = "preferredLanguage"
|
||||
|
||||
-- | User lookup in Microsoft Graph with given credentials
|
||||
azureUser :: ( MonadMask m
|
||||
, MonadUnliftIO m
|
||||
-- , MonadThrow m
|
||||
, MonadHandler m
|
||||
)
|
||||
=> AzureConf
|
||||
-> Creds site
|
||||
-> m [(Text, [ByteString])] -- (Either AzureUserException [(Text, [ByteString])])
|
||||
azureUser _conf _creds = fmap throwLeft . liftIO . runExceptT $ do
|
||||
results <- return [] -- TODO
|
||||
azureUser _conf Creds{..} = fmap throwLeft . runExceptT $ do
|
||||
results <- queryOAuth2User @[(Text, [ByteString])] credsIdent
|
||||
case results of
|
||||
[] -> throwE AzureUserNoResult
|
||||
[res] -> return res
|
||||
_multiple -> throwE AzureUserAmbiguous
|
||||
Left _ -> throwE AzureUserNoResult
|
||||
Right [res] -> return res
|
||||
Right _multiple -> throwE AzureUserAmbiguous
|
||||
|
||||
-- | User lookup in Microsoft Graph with given user
|
||||
azureUser' :: ( MonadMask m
|
||||
, MonadUnliftIO m
|
||||
-- , MonadThrow m
|
||||
, MonadHandler m
|
||||
)
|
||||
=> AzureConf
|
||||
-> User
|
||||
|
||||
Reference in New Issue
Block a user