@@ -82,7 +82,7 @@ guardAuthorised :: RealmName -> Users.Users -> [PrivilegeCondition]
8282 -> ServerEnv
8383 -> ServerPartE UserId
8484guardAuthorised realm users privconds env = do
85- ( uid, _) <- guardAuthenticated realm users env
85+ uid <- guardAuthenticated realm users env
8686 guardPriviledged users uid privconds
8787 return uid
8888
@@ -96,14 +96,14 @@ guardAuthorised realm users privconds env = do
9696-- It only checks the user is known, it does not imply that the user is
9797-- authorised to do anything in particular, see 'guardAuthorised'.
9898--
99- guardAuthenticated :: RealmName -> Users. Users -> ServerEnv -> ServerPartE ( UserId , UserInfo )
99+ guardAuthenticated :: RealmName -> Users. Users -> ServerEnv -> ServerPartE UserId
100100guardAuthenticated realm users env = do
101101 authres <- checkAuthenticated realm users env
102102 case authres of
103103 Left autherr -> throwError =<< authErrorResponse realm autherr
104104 Right info -> return info
105105
106- checkAuthenticated :: ServerMonad m => RealmName -> Users. Users -> ServerEnv -> m (Either AuthError ( UserId , UserInfo ) )
106+ checkAuthenticated :: ServerMonad m => RealmName -> Users. Users -> ServerEnv -> m (Either AuthError UserId )
107107checkAuthenticated realm users ServerEnv { serverRequiredBaseHostHeader } = do
108108 mbHost <- getHost
109109 case mbHost of
@@ -251,15 +251,15 @@ plainHttp req
251251
252252-- | Handle a auth request using an access token
253253checkTokenAuth :: Users. Users -> BS. ByteString
254- -> Either AuthError ( UserId , UserInfo )
254+ -> Either AuthError UserId
255255checkTokenAuth users ahdr = do
256256 parsedToken <-
257257 case Users. parseOriginalToken (T. decodeUtf8 ahdr) of
258258 Left _ -> Left BadApiKeyError
259259 Right tok -> Right (Users. convertToken tok)
260260 (uid, uinfo) <- Users. lookupAuthToken parsedToken users ?! BadApiKeyError
261261 _ <- getUserAuth uinfo ?! UserStatusError uid uinfo
262- return ( uid, uinfo)
262+ return uid
263263
264264------------------------------------------------------------------------
265265-- Basic auth method
@@ -268,15 +268,15 @@ checkTokenAuth users ahdr = do
268268-- | Use HTTP Basic auth to authenticate the client as an active enabled user.
269269--
270270checkBasicAuth :: Users. Users -> RealmName -> BS. ByteString
271- -> Either AuthError ( UserId , UserInfo )
271+ -> Either AuthError UserId
272272checkBasicAuth users realm ahdr = do
273273 authInfo <- getBasicAuthInfo realm ahdr ?! UnrecognizedAuthError
274274 let uname = basicUsername authInfo
275275 (uid, uinfo) <- Users. lookupUserName uname users ?! NoSuchUserError uname
276276 uauth <- getUserAuth uinfo ?! UserStatusError uid uinfo
277277 let passwdhash = getPasswdHash uauth
278278 guard (checkBasicAuthInfo passwdhash authInfo) ?! PasswordMismatchError uid uinfo
279- return ( uid, uinfo)
279+ return uid
280280
281281getBasicAuthInfo :: RealmName -> BS. ByteString -> Maybe BasicAuthInfo
282282getBasicAuthInfo realm authHeader
@@ -327,7 +327,7 @@ headerBasicAuthChallenge (RealmName realmName) =
327327-- | Use HTTP Digest auth to authenticate the client as an active enabled user.
328328--
329329checkDigestAuth :: Users. Users -> BS. ByteString -> Request
330- -> Either AuthError ( UserId , UserInfo )
330+ -> Either AuthError UserId
331331checkDigestAuth users ahdr req = do
332332 authInfo <- getDigestAuthInfo ahdr req ?! UnrecognizedAuthError
333333 let uname = digestUsername authInfo
@@ -337,7 +337,7 @@ checkDigestAuth users ahdr req = do
337337 guard (checkDigestAuthInfo passwdhash authInfo) ?! PasswordMismatchError uid uinfo
338338 -- TODO: if we want to prevent replay attacks, then we must check the
339339 -- nonce and nonce count and issue stale=true replies.
340- return ( uid, uinfo)
340+ return uid
341341
342342-- | retrieve the Digest auth info from the headers
343343--
0 commit comments