Skip to content

Commit

Permalink
fixing servant-auth (aeson 2.0 bump)
Browse files Browse the repository at this point in the history
  • Loading branch information
akhesaCaro committed Nov 14, 2021
1 parent 5b14b5a commit 3e2f28c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion servant-auth/servant-auth/servant-auth.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ library
ghc-options: -Wall
build-depends:
base >= 4.10 && < 4.16
, containers >= 0.6 && < 0.7
, aeson >= 2.0.0.0 && < 3
, jose >= 0.9 && < 0.10
, lens >= 4.16.1 && < 5.1
, servant >= 0.15 && < 0.19
, text >= 1.2.3.0 && < 1.3
, unordered-containers >= 0.2.9.0 && < 0.3
exposed-modules:
Servant.Auth
Servant.Auth.JWT
Expand Down
4 changes: 2 additions & 2 deletions servant-auth/servant-auth/src/Servant/Auth/JWT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Control.Lens ((^.))
import qualified Crypto.JWT as Jose
import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON,
toJSON)
import qualified Data.HashMap.Strict as HM
import qualified Data.Map as Map
import qualified Data.Text as T


Expand All @@ -17,7 +17,7 @@ import qualified Data.Text as T
class FromJWT a where
decodeJWT :: Jose.ClaimsSet -> Either T.Text a
default decodeJWT :: FromJSON a => Jose.ClaimsSet -> Either T.Text a
decodeJWT m = case HM.lookup "dat" (m ^. Jose.unregisteredClaims) of
decodeJWT m = case Map.lookup "dat" (m ^. Jose.unregisteredClaims) of
Nothing -> Left "Missing 'dat' claim"
Just v -> case fromJSON v of
Error e -> Left $ T.pack e
Expand Down

0 comments on commit 3e2f28c

Please sign in to comment.