Merge pull request #37 from Yuras/mongolab-auth
Support mongolab SCRAM auth
This commit is contained in:
commit
ec0dac6915
1 changed files with 10 additions and 1 deletions
|
@ -271,7 +271,16 @@ authSCRAMSHA1 un pw = do
|
||||||
let serverPayload2 = B64.decodeLenient . B.pack $ at "payload" server2
|
let serverPayload2 = B64.decodeLenient . B.pack $ at "payload" server2
|
||||||
let serverData2 = parseSCRAM serverPayload2
|
let serverData2 = parseSCRAM serverPayload2
|
||||||
let serverSigComp = Map.findWithDefault "" "v" serverData2
|
let serverSigComp = Map.findWithDefault "" "v" serverData2
|
||||||
return (serverSig == serverSigComp)
|
|
||||||
|
shortcircuit (serverSig == serverSigComp) $ do
|
||||||
|
let done = true1 "done" server2
|
||||||
|
if done
|
||||||
|
then return True
|
||||||
|
else do
|
||||||
|
let client2 = ["saslContinue" =: (1 :: Int), "conversationId" =: (at "conversationId" server1 :: Int), "payload" =: String ""]
|
||||||
|
server3 <- runCommand client2
|
||||||
|
shortcircuit (true1 "ok" server3) $ do
|
||||||
|
return True
|
||||||
where
|
where
|
||||||
shortcircuit True f = f
|
shortcircuit True f = f
|
||||||
shortcircuit False _ = return False
|
shortcircuit False _ = return False
|
||||||
|
|
Loading…
Reference in a new issue