git.iko.soy/typeable/servant
on master help sign in
Allow using aeson 1 (lax with min-bounds)
commit05ef0dd1d304a9c6f5037ca25c050d06ca7a167d authorakhesacaro <caroline.gaudreau@gmail.com> dateThu 18 Nov 2021, 14:10 (5 years ago) parent62033db
9 files changed+23−15
servant-auth/servant-auth-client/servant-auth-client.cabal+2−2 servant-auth/servant-auth-server/servant-auth-server.cabal+2−2 servant-auth/servant-auth/servant-auth.cabal+3−2 servant-auth/servant-auth/src/Servant/Auth/JWT.hs+9−2 servant-client-core/servant-client-core.cabal+1−1 servant-docs/servant-docs.cabal+1−1 servant-server/servant-server.cabal+2−2 servant-swagger/servant-swagger.cabal+2−2 servant/servant.cabal+1−1
servant-auth/servant-auth-client/servant-auth-client.cabal+2−2
@@ -64,7 +64,7 @@ test-suite spec
6464 build-depends:
6565 hspec >= 2.5.5 && < 2.9
6666 , QuickCheck >= 2.11.3 && < 2.15
67− , aeson >= 2.0.1.0 && < 3
67+ , aeson >= 1.3.1.1 && < 3
6868 , bytestring >= 0.10.6.0 && < 0.11
6969 , http-client >= 0.5.13.1 && < 0.8
7070 , http-types >= 0.12.2 && < 0.13
@@ -74,7 +74,7 @@ test-suite spec
7474 , transformers >= 0.4.2.0 && < 0.6
7575 , wai >= 3.2.1.2 && < 3.3
7676 , warp >= 3.2.25 && < 3.4
77− , jose >= 0.9 && < 0.10
77+ , jose >= 0.7.0.0 && < 0.10
7878 other-modules:
7979 Servant.Auth.ClientSpec
8080 default-language: Haskell2010
servant-auth/servant-auth-server/servant-auth-server.cabal+2−2
@@ -32,7 +32,7 @@ library
3232 ghc-options: -Wall
3333 build-depends:
3434 base >= 4.10 && < 4.16
35− , aeson >= 2.0.1.0 && < 3
35+ , aeson >= 1.0.0.1 && < 3
3636 , base64-bytestring >= 1.0.0.1 && < 2
3737 , blaze-builder >= 0.4.1.0 && < 0.5
3838 , bytestring >= 0.10.6.0 && < 0.11
@@ -41,7 +41,7 @@ library
4141 , data-default-class >= 0.1.2.0 && < 0.2
4242 , entropy >= 0.4.1.3 && < 0.5
4343 , http-types >= 0.12.2 && < 0.13
44− , jose >= 0.9 && < 0.10
44+ , jose >= 0.7.0.0 && < 0.10
4545 , lens >= 4.16.1 && < 5.1
4646 , memory >= 0.14.16 && < 0.17
4747 , monad-time >= 0.3.1.0 && < 0.4
servant-auth/servant-auth/servant-auth.cabal+3−2
@@ -35,11 +35,12 @@ library
3535 build-depends:
3636 base >= 4.10 && < 4.16
3737 , containers >= 0.6 && < 0.7
38− , aeson >= 2.0.1.0 && < 3
39− , jose >= 0.9 && < 0.10
38+ , aeson >= 1.3.1.1 && < 3
39+ , jose >= 0.7.0.0 && < 0.10
4040 , lens >= 4.16.1 && < 5.1
4141 , servant >= 0.15 && < 0.19
4242 , text >= 1.2.3.0 && < 1.3
43+ , unordered-containers >= 0.2.9.0 && < 0.3
4344 exposed-modules:
4445 Servant.Auth
4546 Servant.Auth.JWT
servant-auth/servant-auth/src/Servant/Auth/JWT.hs+9−2
@@ -1,10 +1,17 @@
1+{-# LANGUAGE CPP #-}
2+
13module Servant.Auth.JWT where
24
35import Control.Lens ((^.))
46import qualified Crypto.JWT as Jose
57import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON,
68 toJSON)
7−import qualified Data.Map as Map
9+#if MIN_VERSION_aeson(2,0,0)
10+import qualified Data.Map as KM
11+#else
12+import qualified Data.HashMap.Strict as KM
13+#endif
14+
815import qualified Data.Text as T
916
1017
@@ -17,7 +24,7 @@ import qualified Data.Text as T
1724class FromJWT a where
1825 decodeJWT :: Jose.ClaimsSet -> Either T.Text a
1926 default decodeJWT :: FromJSON a => Jose.ClaimsSet -> Either T.Text a
20− decodeJWT m = case Map.lookup "dat" (m ^. Jose.unregisteredClaims) of
27+ decodeJWT m = case KM.lookup "dat" (m ^. Jose.unregisteredClaims) of
2128 Nothing -> Left "Missing 'dat' claim"
2229 Just v -> case fromJSON v of
2330 Error e -> Left $ T.pack e
servant-client-core/servant-client-core.cabal+1−1
@@ -70,7 +70,7 @@ library
7070 -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
7171 -- Here can be exceptions if we really need features from the newer versions.
7272 build-depends:
73− aeson >= 2.0.1.0 && < 3
73+ aeson >= 1.4.1.0 && < 3
7474 , base-compat >= 0.10.5 && < 0.12
7575 , base64-bytestring >= 1.0.0.1 && < 1.3
7676 , exceptions >= 0.10.0 && < 0.11
servant-docs/servant-docs.cabal+1−1
@@ -52,7 +52,7 @@ library
5252 -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
5353 -- Here can be exceptions if we really need features from the newer versions.
5454 build-depends:
55− aeson >= 2.0.1.0 && < 3
55+ aeson >= 1.4.1.0 && < 3
5656 , aeson-pretty >= 0.8.5 && < 0.9
5757 , base-compat >= 0.10.5 && < 0.12
5858 , case-insensitive >= 1.2.0.11 && < 1.3
servant-server/servant-server.cabal+2−2
@@ -114,7 +114,7 @@ executable greet
114114 , text
115115
116116 build-depends:
117− aeson >= 2.0.1.0 && < 3
117+ aeson >= 1.4.1.0 && < 3
118118 , warp >= 3.2.25 && < 3.4
119119
120120test-suite spec
@@ -157,7 +157,7 @@ test-suite spec
157157
158158 -- Additional dependencies
159159 build-depends:
160− aeson >= 2.0.1.0 && < 3
160+ aeson >= 1.4.1.0 && < 3
161161 , directory >= 1.3.0.0 && < 1.4
162162 , hspec >= 2.6.0 && < 2.9
163163 , hspec-wai >= 0.10.1 && < 0.12
servant-swagger/servant-swagger.cabal+2−2
@@ -68,7 +68,7 @@ library
6868 Servant.Swagger.Internal.TypeLevel.Every
6969 Servant.Swagger.Internal.TypeLevel.TMap
7070 hs-source-dirs: src
71− build-depends: aeson >=2.0.1.0 && <3
71+ build-depends: aeson >=1.4.2.0 && <3
7272 , aeson-pretty >=0.8.7 && <0.9
7373 , base >=4.9.1.0 && <5
7474 , base-compat >=0.10.5 && <0.12
@@ -108,7 +108,7 @@ test-suite spec
108108 build-tool-depends: hspec-discover:hspec-discover >=2.6.0 && <2.8
109109 build-depends: base
110110 , base-compat
111− , aeson >=2.0.1.0 && <3
111+ , aeson >=1.4.2.0 && <3
112112 , hspec >=2.6.0 && <2.8
113113 , QuickCheck
114114 , lens
servant/servant.cabal+1−1
@@ -98,7 +98,7 @@ library
9898 -- Here can be exceptions if we really need features from the newer versions.
9999 build-depends:
100100 base-compat >= 0.10.5 && < 0.12
101− , aeson >= 2.0.1.0 && < 3
101+ , aeson >= 1.4.1.0 && < 3
102102 , attoparsec >= 0.13.2.2 && < 0.15
103103 , bifunctors >= 5.5.3 && < 5.6
104104 , case-insensitive >= 1.2.0.11 && < 1.3