chore: hlint
This commit is contained in:
parent
2787bde8da
commit
acd6a3c11c
@ -120,7 +120,7 @@ azureMockServer port =
|
||||
let oa = OAuth2
|
||||
{ oauth2ClientId = "42"
|
||||
, oauth2ClientSecret = Just "shhh"
|
||||
, oauth2AuthorizeEndpoint = (fromString $ mockServerURL <> "/auth")
|
||||
, 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
|
||||
|
||||
@ -51,7 +51,7 @@ authenticate :: ( MonadHandler m, HandlerSite m ~ UniWorX
|
||||
-> m (AuthenticationResult UniWorX)
|
||||
authenticate creds@Creds{..} = liftHandler . runDB . withReaderT projectBackend $ do
|
||||
$logErrorS "Auth Debug" $ "\a\27[31m" <> tshow creds <> "\27[0m" -- TODO: debug only
|
||||
setSessionJson SessionOAuth2Token $ (getAccessToken creds, getRefreshToken creds)
|
||||
setSessionJson SessionOAuth2Token (getAccessToken creds, getRefreshToken creds)
|
||||
sess <- getSession
|
||||
$logErrorS "OAuth session Debug" $ "\27[34m" <> tshow sess <> "\27[0m" -- TODO: debug only
|
||||
|
||||
@ -210,12 +210,12 @@ fetchUserData Creds{..} = do
|
||||
UpsertUserDataLdap{..} -> (toJSON upsertUserLdapData, AuthSourceIdLdap upsertUserLdapHost)
|
||||
externalUserUser <- if
|
||||
| UpsertUserDataAzure{..} <- res
|
||||
, azureData <- Map.fromListWith (++) $ upsertUserAzureData <&> \(t,bs) -> (t, filter (not . ByteString.null) bs)
|
||||
, [(Text.decodeUtf8' -> Right azureUserPrincipalName')] <- azureData !!! azureUserPrincipalName
|
||||
, azureData <- Map.fromListWith (++) $ upsertUserAzureData <&> second (filter (not . ByteString.null))
|
||||
, [Text.decodeUtf8' -> Right azureUserPrincipalName'] <- azureData !!! azureUserPrincipalName
|
||||
-> return $ CI.mk azureUserPrincipalName'
|
||||
| UpsertUserDataLdap{..} <- res
|
||||
, ldapData <- Map.fromListWith (++) $ upsertUserLdapData <&> \(t,bs) -> (t, filter (not . ByteString.null) bs)
|
||||
, [(Text.decodeUtf8' -> Right ldapPrimaryKey')] <- ldapData !!! ldapPrimaryKey
|
||||
, ldapData <- Map.fromListWith (++) $ upsertUserLdapData <&> second (filter (not . ByteString.null))
|
||||
, [Text.decodeUtf8' -> Right ldapPrimaryKey'] <- ldapData !!! ldapPrimaryKey
|
||||
-> return $ CI.mk ldapPrimaryKey'
|
||||
| otherwise
|
||||
-> throwM DecodeUserInvalidIdent
|
||||
@ -291,11 +291,11 @@ decodeUser :: ( MonadThrow m
|
||||
decodeUser now UserDefaultConf{..} upsertData = do
|
||||
userIdent <- if
|
||||
| Just azureData <- mbAzureData
|
||||
, [(Text.decodeUtf8' -> Right azureUserPrincipalName')] <- azureData !!! azureUserPrincipalName
|
||||
, [Text.decodeUtf8' -> Right azureUserPrincipalName'] <- azureData !!! azureUserPrincipalName
|
||||
, Just azureUserPrincipalName'' <- assertM' (not . Text.null) $ Text.strip azureUserPrincipalName'
|
||||
-> return $ CI.mk azureUserPrincipalName''
|
||||
| Just ldapData <- mbLdapData
|
||||
, [(Text.decodeUtf8' -> Right ldapPrimaryKey')] <- ldapData !!! ldapPrimaryKey
|
||||
, [Text.decodeUtf8' -> Right ldapPrimaryKey'] <- ldapData !!! ldapPrimaryKey
|
||||
, Just ldapPrimaryKey'' <- assertM' (not . Text.null) $ Text.strip ldapPrimaryKey'
|
||||
-> return $ CI.mk ldapPrimaryKey''
|
||||
| otherwise
|
||||
|
||||
@ -140,7 +140,7 @@ instance FromJSON PWHashConf where
|
||||
data AuthSourceConf = AuthSourceConfLdap LdapConf | AuthSourceConfAzureAdV2 AzureConf
|
||||
deriving (Show)
|
||||
|
||||
data UserAuthConf =
|
||||
newtype UserAuthConf =
|
||||
UserAuthConfSingleSource -- ^ use only one specific source
|
||||
{ userAuthConfSingleSource :: AuthSourceConf
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user