Skip to content

Addresses #151 auth function for MongoDB >= 4 #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
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