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