Skip to content

Commit 3a8f4a4

Browse files
committed
refactor: Replace mconcat with sequence of <> in checkForErrors
1 parent 1daacd9 commit 3a8f4a4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/PostgREST/Auth/Jwt.hs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ instance JSON.FromJSON ValidAud where
6767
parseJSON = JSON.genericParseJSON JSON.defaultOptions { JSON.sumEncoding = JSON.UntaggedValue }
6868

6969
checkForErrors :: (Applicative m, Monoid (m JwtClaimsError)) => UTCTime -> (Text -> Bool) -> JSON.Object -> m JwtClaimsError
70-
checkForErrors time audMatches = mconcat
71-
[
72-
claim "exp" ExpClaimNotNumber $ inThePast JWTExpired
73-
, claim "nbf" NbfClaimNotNumber $ inTheFuture JWTNotYetValid
74-
, claim "iat" IatClaimNotNumber $ inTheFuture JWTIssuedAtFuture
75-
, claim "aud" AudClaimNotStringOrURIOrArray $ checkValue (not . validAud) JWTNotInAudience
76-
]
70+
checkForErrors time audMatches =
71+
claim "exp" ExpClaimNotNumber (inThePast JWTExpired)
72+
<> claim "nbf" NbfClaimNotNumber (inTheFuture JWTNotYetValid)
73+
<> claim "iat" IatClaimNotNumber (inTheFuture JWTIssuedAtFuture)
74+
<> claim "aud" AudClaimNotStringOrURIOrArray (checkValue (not . validAud) JWTNotInAudience)
7775
where
7876
allowedSkewSeconds = 30 :: Int64
7977
sciToInt = fromMaybe 0 . Sci.toBoundedInteger

0 commit comments

Comments
 (0)