on master help sign in
Allow mtl-2.3, require jose-0.10 (#1627)
8f081bdJanus Troelsen
servant-auth/servant-auth-client/servant-auth-client.cabal+1−1
@@ -74,7 +74,7 @@ test-suite spec
74 , transformers >= 0.4.2.0 && < 0.6
74 , transformers >= 0.4.2.0 && < 0.6
75 , wai >= 3.2.1.2 && < 3.3
75 , wai >= 3.2.1.2 && < 3.3
76 , warp >= 3.2.25 && < 3.4
76 , warp >= 3.2.25 && < 3.4
77− , jose >= 0.7.0.0 && < 0.10
77+ , jose >= 0.10 && < 0.11
78 other-modules:
78 other-modules:
79 Servant.Auth.ClientSpec
79 Servant.Auth.ClientSpec
80 default-language: Haskell2010
80 default-language: Haskell2010
servant-auth/servant-auth-server/servant-auth-server.cabal+2−2
@@ -41,11 +41,11 @@ library
41 , data-default-class >= 0.1.2.0 && < 0.2
41 , data-default-class >= 0.1.2.0 && < 0.2
42 , entropy >= 0.4.1.3 && < 0.5
42 , entropy >= 0.4.1.3 && < 0.5
43 , http-types >= 0.12.2 && < 0.13
43 , http-types >= 0.12.2 && < 0.13
44− , jose >= 0.7.0.0 && < 0.10
44+ , jose >= 0.10 && < 0.11
45 , lens >= 4.16.1 && < 5.3
45 , lens >= 4.16.1 && < 5.3
46 , memory >= 0.14.16 && < 0.19
46 , memory >= 0.14.16 && < 0.19
47 , monad-time >= 0.3.1.0 && < 0.4
47 , monad-time >= 0.3.1.0 && < 0.4
48− , mtl >= 2.2.2 && < 2.3
48+ , mtl ^>= 2.2.2 || ^>= 2.3.1
49 , servant >= 0.13 && < 0.20
49 , servant >= 0.13 && < 0.20
50 , servant-auth == 0.4.*
50 , servant-auth == 0.4.*
51 , servant-server >= 0.13 && < 0.20
51 , servant-server >= 0.13 && < 0.20
servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs+1
@@ -2,6 +2,7 @@
2module Servant.Auth.Server.Internal.Cookie where
2module Servant.Auth.Server.Internal.Cookie where
3
3
4import Blaze.ByteString.Builder (toByteString)
4import Blaze.ByteString.Builder (toByteString)
5+import Control.Monad (MonadPlus(..), guard)
5import Control.Monad.Except
6import Control.Monad.Except
6import Control.Monad.Reader
7import Control.Monad.Reader
7import qualified Crypto.JOSE as Jose
8import qualified Crypto.JOSE as Jose
servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs+3−7
@@ -1,18 +1,14 @@
1module Servant.Auth.Server.Internal.JWT where
1module Servant.Auth.Server.Internal.JWT where
2
2
3import Control.Lens
3import Control.Lens
4−import Control.Monad.Except
4+import Control.Monad (MonadPlus(..), guard)
5import Control.Monad.Reader
5import Control.Monad.Reader
6import qualified Crypto.JOSE as Jose
6import qualified Crypto.JOSE as Jose
7import qualified Crypto.JWT as Jose
7import qualified Crypto.JWT as Jose
8−import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON,
9− toJSON)
10import Data.ByteArray (constEq)
8import Data.ByteArray (constEq)
11import qualified Data.ByteString as BS
9import qualified Data.ByteString as BS
12import qualified Data.ByteString.Lazy as BSL
10import qualified Data.ByteString.Lazy as BSL
13−import qualified Data.HashMap.Strict as HM
14import Data.Maybe (fromMaybe)
11import Data.Maybe (fromMaybe)
15−import qualified Data.Text as T
16import Data.Time (UTCTime)
12import Data.Time (UTCTime)
17import Network.Wai (requestHeaders)
13import Network.Wai (requestHeaders)
18
14
@@ -42,7 +38,7 @@ jwtAuthCheck jwtSettings = do
42-- token expires.
38-- token expires.
43makeJWT :: ToJWT a
39makeJWT :: ToJWT a
44 => a -> JWTSettings -> Maybe UTCTime -> IO (Either Jose.Error BSL.ByteString)
40 => a -> JWTSettings -> Maybe UTCTime -> IO (Either Jose.Error BSL.ByteString)
45−makeJWT v cfg expiry = runExceptT $ do
41+makeJWT v cfg expiry = Jose.runJOSE $ do
46 bestAlg <- Jose.bestJWSAlg $ signingKey cfg
42 bestAlg <- Jose.bestJWSAlg $ signingKey cfg
47 let alg = fromMaybe bestAlg $ jwtAlg cfg
43 let alg = fromMaybe bestAlg $ jwtAlg cfg
48 ejwt <- Jose.signClaims (signingKey cfg)
44 ejwt <- Jose.signClaims (signingKey cfg)
@@ -59,7 +55,7 @@ makeJWT v cfg expiry = runExceptT $ do
59verifyJWT :: FromJWT a => JWTSettings -> BS.ByteString -> IO (Maybe a)
55verifyJWT :: FromJWT a => JWTSettings -> BS.ByteString -> IO (Maybe a)
60verifyJWT jwtCfg input = do
56verifyJWT jwtCfg input = do
61 keys <- validationKeys jwtCfg
57 keys <- validationKeys jwtCfg
62− verifiedJWT <- runExceptT $ do
58+ verifiedJWT <- Jose.runJOSE $ do
63 unverifiedJWT <- Jose.decodeCompact (BSL.fromStrict input)
59 unverifiedJWT <- Jose.decodeCompact (BSL.fromStrict input)
64 Jose.verifyClaims
60 Jose.verifyClaims
65 (jwtSettingsToJwtValidationSettings jwtCfg)
61 (jwtSettingsToJwtValidationSettings jwtCfg)
servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs+1
@@ -2,6 +2,7 @@
2module Servant.Auth.Server.Internal.Types where
2module Servant.Auth.Server.Internal.Types where
3
3
4import Control.Applicative
4import Control.Applicative
5+import Control.Monad (MonadPlus(..), ap)
5import Control.Monad.Reader
6import Control.Monad.Reader
6import Control.Monad.Time
7import Control.Monad.Time
7import Data.Monoid (Monoid (..))
8import Data.Monoid (Monoid (..))
servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs+2−3
@@ -6,13 +6,12 @@ module Servant.Auth.ServerSpec (spec) where
6#endif
6#endif
7
7
8import Control.Lens
8import Control.Lens
9−import Control.Monad.Except (runExceptT)
10import Control.Monad.IO.Class (liftIO)
9import Control.Monad.IO.Class (liftIO)
11import Crypto.JOSE (Alg (HS256, None), Error,
10import Crypto.JOSE (Alg (HS256, None), Error,
12 JWK, JWSHeader,
11 JWK, JWSHeader,
13 KeyMaterialGenParam (OctGenParam),
12 KeyMaterialGenParam (OctGenParam),
14 ToCompact, encodeCompact,
13 ToCompact, encodeCompact,
15− genJWK, newJWSHeader)
14+ genJWK, newJWSHeader, runJOSE)
16import Crypto.JWT (Audience (..), ClaimsSet,
15import Crypto.JWT (Audience (..), ClaimsSet,
17 NumericDate (NumericDate),
16 NumericDate (NumericDate),
18 SignedJWT,
17 SignedJWT,
@@ -540,7 +539,7 @@ addJwtToHeader jwt = case jwt of
540 $ defaults & header "Authorization" .~ ["Bearer " <> BSL.toStrict v]
539 $ defaults & header "Authorization" .~ ["Bearer " <> BSL.toStrict v]
541
540
542createJWT :: JWK -> JWSHeader () -> ClaimsSet -> IO (Either Error Crypto.JWT.SignedJWT)
541createJWT :: JWK -> JWSHeader () -> ClaimsSet -> IO (Either Error Crypto.JWT.SignedJWT)
543−createJWT k a b = runExceptT $ signClaims k a b
542+createJWT k a b = runJOSE $ signClaims k a b
544
543
545addJwtToCookie :: ToCompact a => CookieSettings -> Either Error a -> IO Options
544addJwtToCookie :: ToCompact a => CookieSettings -> Either Error a -> IO Options
546addJwtToCookie ccfg jwt = case jwt >>= (return . encodeCompact) of
545addJwtToCookie ccfg jwt = case jwt >>= (return . encodeCompact) of
servant-auth/servant-auth/servant-auth.cabal+1−1
@@ -36,7 +36,7 @@ library
36 base >= 4.10 && < 4.18
36 base >= 4.10 && < 4.18
37 , containers >= 0.6 && < 0.7
37 , containers >= 0.6 && < 0.7
38 , aeson >= 1.3.1.1 && < 3
38 , aeson >= 1.3.1.1 && < 3
39− , jose >= 0.7.0.0 && < 0.10
39+ , jose >= 0.10 && < 0.11
40 , lens >= 4.16.1 && < 5.3
40 , lens >= 4.16.1 && < 5.3
41 , servant >= 0.15 && < 0.20
41 , servant >= 0.15 && < 0.20
42 , text >= 1.2.3.0 && < 2.1
42 , text >= 1.2.3.0 && < 2.1
servant-client-core/servant-client-core.cabal+1−1
@@ -56,7 +56,7 @@ library
56 , containers >= 0.5.7.1 && < 0.7
56 , containers >= 0.5.7.1 && < 0.7
57 , deepseq >= 1.4.2.0 && < 1.5
57 , deepseq >= 1.4.2.0 && < 1.5
58 , text >= 1.2.3.0 && < 2.1
58 , text >= 1.2.3.0 && < 2.1
59− , transformers >= 0.5.2.0 && < 0.6
59+ , transformers >= 0.5.2.0 && < 0.7
60 , template-haskell >= 2.11.1.0 && < 2.20
60 , template-haskell >= 2.11.1.0 && < 2.20
61
61
62 if !impl(ghc >= 8.2)
62 if !impl(ghc >= 8.2)
servant-client-ghcjs/servant-client-ghcjs.cabal+1−1
@@ -48,7 +48,7 @@ library
48 , http-media >=0.6.2 && <0.9
48 , http-media >=0.6.2 && <0.9
49 , http-types >=0.12 && <0.13
49 , http-types >=0.12 && <0.13
50 , monad-control >=1.0.0.4 && <1.1
50 , monad-control >=1.0.0.4 && <1.1
51− , mtl >=2.2.2 && <2.3
51+ , mtl ^>=2.2.2 || ^>=2.3.1
52 , semigroupoids >=5.3 && <5.4
52 , semigroupoids >=5.3 && <5.4
53 , string-conversions >=0.3 && <0.5
53 , string-conversions >=0.3 && <0.5
54 , transformers >=0.3 && <0.6
54 , transformers >=0.3 && <0.6
servant-client/servant-client.cabal+2−2
@@ -45,11 +45,11 @@ library
45 , bytestring >= 0.10.8.1 && < 0.12
45 , bytestring >= 0.10.8.1 && < 0.12
46 , containers >= 0.5.7.1 && < 0.7
46 , containers >= 0.5.7.1 && < 0.7
47 , deepseq >= 1.4.2.0 && < 1.5
47 , deepseq >= 1.4.2.0 && < 1.5
48− , mtl >= 2.2.2 && < 2.3
48+ , mtl ^>= 2.2.2 || ^>= 2.3.1
49 , stm >= 2.4.5.1 && < 2.6
49 , stm >= 2.4.5.1 && < 2.6
50 , text >= 1.2.3.0 && < 2.1
50 , text >= 1.2.3.0 && < 2.1
51 , time >= 1.6.0.1 && < 1.13
51 , time >= 1.6.0.1 && < 1.13
52− , transformers >= 0.5.2.0 && < 0.6
52+ , transformers >= 0.5.2.0 && < 0.7
53
53
54 if !impl(ghc >= 8.2)
54 if !impl(ghc >= 8.2)
55 build-depends:
55 build-depends:
servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs+2−1
@@ -24,7 +24,8 @@ import Control.DeepSeq
24 (NFData, force)
24 (NFData, force)
25import Control.Exception
25import Control.Exception
26 (evaluate, throwIO)
26 (evaluate, throwIO)
27−import Control.Monad ()
27+import Control.Monad
28+ (unless)
28import Control.Monad.Base
29import Control.Monad.Base
29 (MonadBase (..))
30 (MonadBase (..))
30import Control.Monad.Codensity
31import Control.Monad.Codensity
servant-conduit/servant-conduit.cabal+1−1
@@ -31,7 +31,7 @@ library
31 base >=4.9 && <5
31 base >=4.9 && <5
32 , bytestring >=0.10.8.1 && <0.12
32 , bytestring >=0.10.8.1 && <0.12
33 , conduit >=1.3.1 && <1.4
33 , conduit >=1.3.1 && <1.4
34− , mtl >=2.2.2 && <2.3
34+ , mtl ^>=2.2.2 || ^>=2.3.1
35 , resourcet >=1.2.2 && <1.3
35 , resourcet >=1.2.2 && <1.3
36 , servant >=0.15 && <0.20
36 , servant >=0.15 && <0.20
37 , unliftio-core >=0.1.2.0 && <0.3
37 , unliftio-core >=0.1.2.0 && <0.3
servant-http-streams/servant-http-streams.cabal+2−2
@@ -42,10 +42,10 @@ library
42 , bytestring >= 0.10.8.1 && < 0.12
42 , bytestring >= 0.10.8.1 && < 0.12
43 , containers >= 0.5.7.1 && < 0.7
43 , containers >= 0.5.7.1 && < 0.7
44 , deepseq >= 1.4.2.0 && < 1.5
44 , deepseq >= 1.4.2.0 && < 1.5
45− , mtl >= 2.2.2 && < 2.3
45+ , mtl ^>= 2.2.2 || ^>= 2.3.1
46 , text >= 1.2.3.0 && < 2.1
46 , text >= 1.2.3.0 && < 2.1
47 , time >= 1.6.0.1 && < 1.13
47 , time >= 1.6.0.1 && < 1.13
48− , transformers >= 0.5.2.0 && < 0.6
48+ , transformers >= 0.5.2.0 && < 0.7
49
49
50 if !impl(ghc >= 8.2)
50 if !impl(ghc >= 8.2)
51 build-depends:
51 build-depends:
servant-machines/servant-machines.cabal+1−1
@@ -31,7 +31,7 @@ library
31 base >=4.9 && <5
31 base >=4.9 && <5
32 , bytestring >=0.10.8.1 && <0.12
32 , bytestring >=0.10.8.1 && <0.12
33 , machines >=0.6.4 && <0.8
33 , machines >=0.6.4 && <0.8
34− , mtl >=2.2.2 && <2.3
34+ , mtl ^>=2.2.2 || ^>=2.3.1
35 , servant >=0.15 && <0.20
35 , servant >=0.15 && <0.20
36 hs-source-dirs: src
36 hs-source-dirs: src
37 default-language: Haskell2010
37 default-language: Haskell2010
servant-pipes/servant-pipes.cabal+1−1
@@ -32,7 +32,7 @@ library
32 , bytestring >=0.10.8.1 && <0.12
32 , bytestring >=0.10.8.1 && <0.12
33 , pipes >=4.3.9 && <4.4
33 , pipes >=4.3.9 && <4.4
34 , pipes-safe >=2.3.1 && <2.4
34 , pipes-safe >=2.3.1 && <2.4
35− , mtl >=2.2.2 && <2.3
35+ , mtl ^>=2.2.2 || ^>=2.3.1
36 , monad-control >=1.0.2.3 && <1.1
36 , monad-control >=1.0.2.3 && <1.1
37 , servant >=0.15 && <0.20
37 , servant >=0.15 && <0.20
38 hs-source-dirs: src
38 hs-source-dirs: src
servant-server/servant-server.cabal+2−2
@@ -64,9 +64,9 @@ library
64 , bytestring >= 0.10.8.1 && < 0.12
64 , bytestring >= 0.10.8.1 && < 0.12
65 , constraints >= 0.2 && < 0.14
65 , constraints >= 0.2 && < 0.14
66 , containers >= 0.5.7.1 && < 0.7
66 , containers >= 0.5.7.1 && < 0.7
67− , mtl >= 2.2.2 && < 2.3
67+ , mtl ^>= 2.2.2 || ^>= 2.3.1
68 , text >= 1.2.3.0 && < 2.1
68 , text >= 1.2.3.0 && < 2.1
69− , transformers >= 0.5.2.0 && < 0.6
69+ , transformers >= 0.5.2.0 && < 0.7
70 , filepath >= 1.4.1.1 && < 1.5
70 , filepath >= 1.4.1.1 && < 1.5
71
71
72 -- Servant dependencies
72 -- Servant dependencies
servant/servant.cabal+2−2
@@ -83,9 +83,9 @@ library
83 base >= 4.9 && < 4.18
83 base >= 4.9 && < 4.18
84 , bytestring >= 0.10.8.1 && < 0.12
84 , bytestring >= 0.10.8.1 && < 0.12
85 , constraints >= 0.2
85 , constraints >= 0.2
86− , mtl >= 2.2.2 && < 2.3
86+ , mtl ^>= 2.2.2 || ^>= 2.3.1
87 , sop-core >= 0.4.0.0 && < 0.6
87 , sop-core >= 0.4.0.0 && < 0.6
88− , transformers >= 0.5.2.0 && < 0.6
88+ , transformers >= 0.5.2.0 && < 0.7
89 , text >= 1.2.3.0 && < 2.1
89 , text >= 1.2.3.0 && < 2.1
90
90
91
91
servant/src/Servant/Types/SourceT.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DeriveFunctor #-}
2{-# LANGUAGE DeriveFunctor #-}
2{-# LANGUAGE GADTs #-}
3{-# LANGUAGE GADTs #-}
3{-# LANGUAGE RankNTypes #-}
4{-# LANGUAGE RankNTypes #-}
@@ -154,8 +155,10 @@ instance (Applicative m, Show1 m, Show a) => Show (StepT m a) where
154-- | >>> lift [1,2,3] :: StepT [] Int
155-- | >>> lift [1,2,3] :: StepT [] Int
155-- Effect [Yield 1 Stop,Yield 2 Stop,Yield 3 Stop]
156-- Effect [Yield 1 Stop,Yield 2 Stop,Yield 3 Stop]
156--
157--
158+#if !MIN_VERSION_transformers(0,6,0)
157instance MonadTrans StepT where
159instance MonadTrans StepT where
158 lift = Effect . fmap (`Yield` Stop)
160 lift = Effect . fmap (`Yield` Stop)
161+#endif
159
162
160instance MFunctor StepT where
163instance MFunctor StepT where
161 hoist f = go where
164 hoist f = go where