jwtClaims should always return Left for invalid JWT

This commit is contained in:
Diogo Biazus
2016-05-21 13:18:45 -04:00
parent 2cb04c1d5c
commit abd81c998b
2 changed files with 13 additions and 18 deletions
+1 -4
View File
@@ -30,10 +30,7 @@ runWithClaims :: AppConfig -> Either Text (M.HashMap Text Value) ->
runWithClaims conf eClaims app req =
case eClaims of
Left e -> clientErr e
Right claims ->
if M.null claims && not (null $ iJWT req)
then clientErr "Invalid JWT"
else do
Right claims -> do
-- role claim defaults to anon if not specified in jwt
H.sql . mconcat . claimsToSQL $ M.union claims (M.singleton "role" anon)
app req