Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Addresses #151 where auth function fails for mongoDB versions 4 and g…
…reater.
  • Loading branch information
jcmartin committed Oct 26, 2024
commit 03b50fe85f5f770867697877d63321f8cfe1db87
8 changes: 4 additions & 4 deletions Database/MongoDB/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
pwKey,
FlagBit (..)
)
import Control.Monad.Trans.Except

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo_atlas, 8.10.4)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:4.0, latest)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:5.0, latest)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:7.0, latest)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:6.0, latest)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:7.0, 8.10.4)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:4.0, 8.10.4)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:6.0, 8.10.4)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:4.0, 9.4.7)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:5.0, 8.10.4)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:5.0, 9.4.7)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:6.0, 9.4.7)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:7.0, 9.4.7)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo_atlas, latest)

The import of ‘Control.Monad.Trans.Except’ is redundant

Check warning on line 136 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo_atlas, 9.4.7)

The import of ‘Control.Monad.Trans.Except’ is redundant
import qualified Database.MongoDB.Internal.Protocol as P
import Database.MongoDB.Internal.Util (liftIOE, loop, true1, (<.>), splitDot)

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo_atlas, 8.10.4)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:4.0, latest)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:5.0, latest)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:7.0, latest)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:6.0, latest)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:7.0, 8.10.4)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:4.0, 8.10.4)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:6.0, 8.10.4)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:4.0, 9.4.7)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:5.0, 8.10.4)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:5.0, 9.4.7)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:6.0, 9.4.7)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo:7.0, 9.4.7)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo_atlas, latest)

The import of ‘splitDot’

Check warning on line 138 in Database/MongoDB/Query.hs

View workflow job for this annotation

GitHub Actions / test (mongo_atlas, 9.4.7)

The import of ‘splitDot’
import System.Mem.Weak (Weak)
import Text.Read (readMaybe)
import Prelude hiding (lookup)
Expand Down Expand Up @@ -276,10 +276,10 @@
mmv <- readMaybe . T.unpack . head . T.splitOn "." <$> serverVersion
maybe (return False) performAuth mmv
where
performAuth majorVersion =
if majorVersion >= (3 :: Int)
then authSCRAMSHA1 un pw
else authMongoCR un pw
performAuth majorVersion
| majorVersion >= (4 :: Int) = authSCRAMSHA256 un pw
| majorVersion >= 3 = authSCRAMSHA1 un pw
| otherwise = authMongoCR un pw

authMongoCR :: (MonadIO m) => Username -> Password -> Action m Bool
-- ^ Authenticate with the current database, using the MongoDB-CR authentication mechanism (default in MongoDB server < 3.0)
Expand Down
Loading