on master help sign in
Allow mtl-2.3, require jose-0.10 (#1627)
commit8f081bd9ad69aaa4ed4f27444e15433b36177b42 authorJanus Troelsen <janus@flipstone.com> dateThu 17 Nov 2022, 09:58 (4 years ago) parentad25e98
18 files changed+29−28
servant-auth/servant-auth-client/servant-auth-client.cabal+1−1 servant-auth/servant-auth-server/servant-auth-server.cabal+2−2 servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs+1 servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs+3−7 servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs+1 servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs+2−3 servant-auth/servant-auth/servant-auth.cabal+1−1 servant-client-core/servant-client-core.cabal+1−1 servant-client-ghcjs/servant-client-ghcjs.cabal+1−1 servant-client/servant-client.cabal+2−2 servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs+2−1 servant-conduit/servant-conduit.cabal+1−1 servant-http-streams/servant-http-streams.cabal+2−2 servant-machines/servant-machines.cabal+1−1 servant-pipes/servant-pipes.cabal+1−1 servant-server/servant-server.cabal+2−2 servant/servant.cabal+2−2 servant/src/Servant/Types/SourceT.hs+3
servant-auth/servant-auth-client/servant-auth-client.cabal+1−1
@@ -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.7.0.0 && < 0.10
77+ , jose >= 0.10 && < 0.11
7878 other-modules:
7979 Servant.Auth.ClientSpec
8080 default-language: Haskell2010
servant-auth/servant-auth-server/servant-auth-server.cabal+2−2
@@ -41,11 +41,11 @@ 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.7.0.0 && < 0.10
44+ , jose >= 0.10 && < 0.11
4545 , lens >= 4.16.1 && < 5.3
4646 , memory >= 0.14.16 && < 0.19
4747 , monad-time >= 0.3.1.0 && < 0.4
48− , mtl >= 2.2.2 && < 2.3
48+ , mtl ^>= 2.2.2 || ^>= 2.3.1
4949 , servant >= 0.13 && < 0.20
5050 , servant-auth == 0.4.*
5151 , servant-server >= 0.13 && < 0.20
servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs+1
@@ -2,6 +2,7 @@
22module Servant.Auth.Server.Internal.Cookie where
33
44import Blaze.ByteString.Builder (toByteString)
5+import Control.Monad (MonadPlus(..), guard)
56import Control.Monad.Except
67import Control.Monad.Reader
78import qualified Crypto.JOSE as Jose
servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs+3−7
@@ -1,18 +1,14 @@
11module Servant.Auth.Server.Internal.JWT where
22
33import Control.Lens
4−import Control.Monad.Except
4+import Control.Monad (MonadPlus(..), guard)
55import Control.Monad.Reader
66import qualified Crypto.JOSE as Jose
77import qualified Crypto.JWT as Jose
8−import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON,
9− toJSON)
108import Data.ByteArray (constEq)
119import qualified Data.ByteString as BS
1210import qualified Data.ByteString.Lazy as BSL
13−import qualified Data.HashMap.Strict as HM
1411import Data.Maybe (fromMaybe)
15−import qualified Data.Text as T
1612import Data.Time (UTCTime)
1713import Network.Wai (requestHeaders)
1814
@@ -42,7 +38,7 @@ jwtAuthCheck jwtSettings = do
4238-- token expires.
4339makeJWT :: ToJWT a
4440 => 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
4642 bestAlg <- Jose.bestJWSAlg $ signingKey cfg
4743 let alg = fromMaybe bestAlg $ jwtAlg cfg
4844 ejwt <- Jose.signClaims (signingKey cfg)
@@ -59,7 +55,7 @@ makeJWT v cfg expiry = runExceptT $ do
5955verifyJWT :: FromJWT a => JWTSettings -> BS.ByteString -> IO (Maybe a)
6056verifyJWT jwtCfg input = do
6157 keys <- validationKeys jwtCfg
62− verifiedJWT <- runExceptT $ do
58+ verifiedJWT <- Jose.runJOSE $ do
6359 unverifiedJWT <- Jose.decodeCompact (BSL.fromStrict input)
6460 Jose.verifyClaims
6561 (jwtSettingsToJwtValidationSettings jwtCfg)
servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs+1
@@ -2,6 +2,7 @@
22module Servant.Auth.Server.Internal.Types where
33
44import Control.Applicative
5+import Control.Monad (MonadPlus(..), ap)
56import Control.Monad.Reader
67import Control.Monad.Time
78import 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
66#endif
77
88import Control.Lens
9−import Control.Monad.Except (runExceptT)
109import Control.Monad.IO.Class (liftIO)
1110import Crypto.JOSE (Alg (HS256, None), Error,
1211 JWK, JWSHeader,
1312 KeyMaterialGenParam (OctGenParam),
1413 ToCompact, encodeCompact,
15− genJWK, newJWSHeader)
14+ genJWK, newJWSHeader, runJOSE)
1615import Crypto.JWT (Audience (..), ClaimsSet,
1716 NumericDate (NumericDate),
1817 SignedJWT,
@@ -540,7 +539,7 @@ addJwtToHeader jwt = case jwt of
540539 $ defaults & header "Authorization" .~ ["Bearer " <> BSL.toStrict v]
541540
542541createJWT :: 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
544543
545544addJwtToCookie :: ToCompact a => CookieSettings -> Either Error a -> IO Options
546545addJwtToCookie ccfg jwt = case jwt >>= (return . encodeCompact) of
servant-auth/servant-auth/servant-auth.cabal+1−1
@@ -36,7 +36,7 @@ library
3636 base >= 4.10 && < 4.18
3737 , containers >= 0.6 && < 0.7
3838 , aeson >= 1.3.1.1 && < 3
39− , jose >= 0.7.0.0 && < 0.10
39+ , jose >= 0.10 && < 0.11
4040 , lens >= 4.16.1 && < 5.3
4141 , servant >= 0.15 && < 0.20
4242 , text >= 1.2.3.0 && < 2.1
servant-client-core/servant-client-core.cabal+1−1
@@ -56,7 +56,7 @@ library
5656 , containers >= 0.5.7.1 && < 0.7
5757 , deepseq >= 1.4.2.0 && < 1.5
5858 , text >= 1.2.3.0 && < 2.1
59− , transformers >= 0.5.2.0 && < 0.6
59+ , transformers >= 0.5.2.0 && < 0.7
6060 , template-haskell >= 2.11.1.0 && < 2.20
6161
6262 if !impl(ghc >= 8.2)
servant-client-ghcjs/servant-client-ghcjs.cabal+1−1
@@ -48,7 +48,7 @@ library
4848 , http-media >=0.6.2 && <0.9
4949 , http-types >=0.12 && <0.13
5050 , monad-control >=1.0.0.4 && <1.1
51− , mtl >=2.2.2 && <2.3
51+ , mtl ^>=2.2.2 || ^>=2.3.1
5252 , semigroupoids >=5.3 && <5.4
5353 , string-conversions >=0.3 && <0.5
5454 , transformers >=0.3 && <0.6
servant-client/servant-client.cabal+2−2
@@ -45,11 +45,11 @@ library
4545 , bytestring >= 0.10.8.1 && < 0.12
4646 , containers >= 0.5.7.1 && < 0.7
4747 , deepseq >= 1.4.2.0 && < 1.5
48− , mtl >= 2.2.2 && < 2.3
48+ , mtl ^>= 2.2.2 || ^>= 2.3.1
4949 , stm >= 2.4.5.1 && < 2.6
5050 , text >= 1.2.3.0 && < 2.1
5151 , time >= 1.6.0.1 && < 1.13
52− , transformers >= 0.5.2.0 && < 0.6
52+ , transformers >= 0.5.2.0 && < 0.7
5353
5454 if !impl(ghc >= 8.2)
5555 build-depends:
servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs+2−1
@@ -24,7 +24,8 @@ import Control.DeepSeq
2424 (NFData, force)
2525import Control.Exception
2626 (evaluate, throwIO)
27−import Control.Monad ()
27+import Control.Monad
28+ (unless)
2829import Control.Monad.Base
2930 (MonadBase (..))
3031import Control.Monad.Codensity
servant-conduit/servant-conduit.cabal+1−1
@@ -31,7 +31,7 @@ library
3131 base >=4.9 && <5
3232 , bytestring >=0.10.8.1 && <0.12
3333 , conduit >=1.3.1 && <1.4
34− , mtl >=2.2.2 && <2.3
34+ , mtl ^>=2.2.2 || ^>=2.3.1
3535 , resourcet >=1.2.2 && <1.3
3636 , servant >=0.15 && <0.20
3737 , unliftio-core >=0.1.2.0 && <0.3
servant-http-streams/servant-http-streams.cabal+2−2
@@ -42,10 +42,10 @@ library
4242 , bytestring >= 0.10.8.1 && < 0.12
4343 , containers >= 0.5.7.1 && < 0.7
4444 , deepseq >= 1.4.2.0 && < 1.5
45− , mtl >= 2.2.2 && < 2.3
45+ , mtl ^>= 2.2.2 || ^>= 2.3.1
4646 , text >= 1.2.3.0 && < 2.1
4747 , time >= 1.6.0.1 && < 1.13
48− , transformers >= 0.5.2.0 && < 0.6
48+ , transformers >= 0.5.2.0 && < 0.7
4949
5050 if !impl(ghc >= 8.2)
5151 build-depends:
servant-machines/servant-machines.cabal+1−1
@@ -31,7 +31,7 @@ library
3131 base >=4.9 && <5
3232 , bytestring >=0.10.8.1 && <0.12
3333 , machines >=0.6.4 && <0.8
34− , mtl >=2.2.2 && <2.3
34+ , mtl ^>=2.2.2 || ^>=2.3.1
3535 , servant >=0.15 && <0.20
3636 hs-source-dirs: src
3737 default-language: Haskell2010
servant-pipes/servant-pipes.cabal+1−1
@@ -32,7 +32,7 @@ library
3232 , bytestring >=0.10.8.1 && <0.12
3333 , pipes >=4.3.9 && <4.4
3434 , pipes-safe >=2.3.1 && <2.4
35− , mtl >=2.2.2 && <2.3
35+ , mtl ^>=2.2.2 || ^>=2.3.1
3636 , monad-control >=1.0.2.3 && <1.1
3737 , servant >=0.15 && <0.20
3838 hs-source-dirs: src
servant-server/servant-server.cabal+2−2
@@ -64,9 +64,9 @@ library
6464 , bytestring >= 0.10.8.1 && < 0.12
6565 , constraints >= 0.2 && < 0.14
6666 , containers >= 0.5.7.1 && < 0.7
67− , mtl >= 2.2.2 && < 2.3
67+ , mtl ^>= 2.2.2 || ^>= 2.3.1
6868 , text >= 1.2.3.0 && < 2.1
69− , transformers >= 0.5.2.0 && < 0.6
69+ , transformers >= 0.5.2.0 && < 0.7
7070 , filepath >= 1.4.1.1 && < 1.5
7171
7272 -- Servant dependencies
servant/servant.cabal+2−2
@@ -83,9 +83,9 @@ library
8383 base >= 4.9 && < 4.18
8484 , bytestring >= 0.10.8.1 && < 0.12
8585 , constraints >= 0.2
86− , mtl >= 2.2.2 && < 2.3
86+ , mtl ^>= 2.2.2 || ^>= 2.3.1
8787 , sop-core >= 0.4.0.0 && < 0.6
88− , transformers >= 0.5.2.0 && < 0.6
88+ , transformers >= 0.5.2.0 && < 0.7
8989 , text >= 1.2.3.0 && < 2.1
9090
9191
servant/src/Servant/Types/SourceT.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DeriveFunctor #-}
23{-# LANGUAGE GADTs #-}
34{-# LANGUAGE RankNTypes #-}
@@ -154,8 +155,10 @@ instance (Applicative m, Show1 m, Show a) => Show (StepT m a) where
154155-- | >>> lift [1,2,3] :: StepT [] Int
155156-- Effect [Yield 1 Stop,Yield 2 Stop,Yield 3 Stop]
156157--
158+#if !MIN_VERSION_transformers(0,6,0)
157159instance MonadTrans StepT where
158160 lift = Effect . fmap (`Yield` Stop)
161+#endif
159162
160163instance MFunctor StepT where
161164 hoist f = go where