chore(auth): authenticate against new InternalAuthHash in internal login AuthPlugin
This commit is contained in:
parent
938423b832
commit
29fc201294
@ -1,4 +1,4 @@
|
|||||||
-- SPDX-FileCopyrightText: 2022 Felix Hamann <felix.hamann@campus.lmu.de>,Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>
|
-- SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Felix Hamann <felix.hamann@campus.lmu.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>, Sarah Vaupel <sarah.vaupel@ifi.lmu.de>
|
||||||
--
|
--
|
||||||
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
@ -68,12 +68,12 @@ hashLogin pwHashAlgo = AuthPlugin{..}
|
|||||||
tp <- getRouteToParent
|
tp <- getRouteToParent
|
||||||
|
|
||||||
resp <- formResultMaybe loginRes $ \HashLogin{..} -> Just <$> do
|
resp <- formResultMaybe loginRes $ \HashLogin{..} -> Just <$> do
|
||||||
user <- liftHandler . runDB . getBy $ UniqueAuthentication hashIdent
|
auth :: Maybe (Entity InternalAuth) <- liftHandler . runDB . getBy $ UniqueInternalAuth hashIdent
|
||||||
case user of
|
case auth of
|
||||||
Just (Entity _ User{ userAuthentication = AuthPWHash{..}, userIdent = CI.original -> userIdent })
|
Just (Entity _ InternalAuth{..})
|
||||||
| verifyPasswordWith pwHashAlgo (2^) (encodeUtf8 hashPassword) (encodeUtf8 authPWHash) -> do -- (2^) is magic.
|
| verifyPasswordWith pwHashAlgo (2^) (encodeUtf8 hashPassword) (encodeUtf8 internalAuthHash) -> do -- (2^) is magic.
|
||||||
observeLoginOutcome apName LoginSuccessful
|
observeLoginOutcome apName LoginSuccessful
|
||||||
setCredsRedirect $ Creds apName userIdent []
|
setCredsRedirect $ Creds apName (CI.original internalAuthIdent) []
|
||||||
other -> do
|
other -> do
|
||||||
$logDebugS apName $ tshow other
|
$logDebugS apName $ tshow other
|
||||||
observeLoginOutcome apName LoginInvalidCredentials
|
observeLoginOutcome apName LoginInvalidCredentials
|
||||||
|
|||||||
Reference in New Issue
Block a user