Skip to content

Commit 8f081bd

Browse files
authored
Allow mtl-2.3, require jose-0.10 (#1627)
1 parent ad25e98 commit 8f081bd

File tree

18 files changed

+29
-28
lines changed

18 files changed

+29
-28
lines changed

servant-auth/servant-auth-client/servant-auth-client.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
module Servant.Auth.Server.Internal.Cookie where
33

44
import Blaze.ByteString.Builder (toByteString)
5+
import Control.Monad (MonadPlus(..), guard)
56
import Control.Monad.Except
67
import Control.Monad.Reader
78
import qualified Crypto.JOSE as Jose

servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
module Servant.Auth.Server.Internal.JWT where
22

33
import Control.Lens
4-
import Control.Monad.Except
4+
import Control.Monad (MonadPlus(..), guard)
55
import Control.Monad.Reader
66
import qualified Crypto.JOSE as Jose
77
import qualified Crypto.JWT as Jose
8-
import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON,
9-
toJSON)
108
import Data.ByteArray (constEq)
119
import qualified Data.ByteString as BS
1210
import qualified Data.ByteString.Lazy as BSL
13-
import qualified Data.HashMap.Strict as HM
1411
import Data.Maybe (fromMaybe)
15-
import qualified Data.Text as T
1612
import Data.Time (UTCTime)
1713
import Network.Wai (requestHeaders)
1814

@@ -42,7 +38,7 @@ jwtAuthCheck jwtSettings = do
4238
-- token expires.
4339
makeJWT :: 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
5955
verifyJWT :: FromJWT a => JWTSettings -> BS.ByteString -> IO (Maybe a)
6056
verifyJWT 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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
module Servant.Auth.Server.Internal.Types where
33

44
import Control.Applicative
5+
import Control.Monad (MonadPlus(..), ap)
56
import Control.Monad.Reader
67
import Control.Monad.Time
78
import Data.Monoid (Monoid (..))

servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ module Servant.Auth.ServerSpec (spec) where
66
#endif
77

88
import Control.Lens
9-
import Control.Monad.Except (runExceptT)
109
import Control.Monad.IO.Class (liftIO)
1110
import Crypto.JOSE (Alg (HS256, None), Error,
1211
JWK, JWSHeader,
1312
KeyMaterialGenParam (OctGenParam),
1413
ToCompact, encodeCompact,
15-
genJWK, newJWSHeader)
14+
genJWK, newJWSHeader, runJOSE)
1615
import 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

542541
createJWT :: 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

545544
addJwtToCookie :: ToCompact a => CookieSettings -> Either Error a -> IO Options
546545
addJwtToCookie ccfg jwt = case jwt >>= (return . encodeCompact) of

servant-auth/servant-auth/servant-auth.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

0 commit comments

Comments
 (0)