servant-auth-client 0.3.3.0 → 0.4.0.0
raw patch · 4 files changed
+40/−58 lines, 4 filesdep −textdep ~QuickCheckdep ~aesondep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: text
Dependency ranges changed: QuickCheck, aeson, base, bytestring, containers, hspec, http-client, http-types, jose, servant, servant-auth-server, servant-client, servant-client-core, servant-server, time, transformers, wai, warp
API changes (from Hackage documentation)
- Servant.Auth.Client.Internal: instance (Servant.Auth.Client.Internal.HasJWT auths, Servant.Client.Core.Internal.HasClient.HasClient m api) => Servant.Client.Core.Internal.HasClient.HasClient m (Servant.Auth.Auth auths a Servant.API.Sub.:> api)
+ Servant.Auth.Client.Internal: instance (Servant.Auth.Client.Internal.HasJWT auths, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.Auth.Auth auths a Servant.API.Sub.:> api)
+ Servant.Auth.Client.Internal: type family HasJWT xs :: Constraint
Files
- CHANGELOG.md +8/−1
- servant-auth-client.cabal +21/−33
- src/Servant/Auth/Client/Internal.hs +0/−20
- test/Servant/Auth/ClientSpec.hs +11/−4
CHANGELOG.md view
@@ -3,9 +3,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)-and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).+and this project adheres to [PVP Versioning](https://pvp.haskell.org/). ## [Unreleased]++## [0.4.0.0] - 2019-03-08++## Changed++- #145 Support servant-0.16 in tests @domenkozar+- #145 Drop GHC 7.10 support @domenkozar ## [0.3.3.0] - 2018-06-18
servant-auth-client.cabal view
@@ -1,5 +1,5 @@ name: servant-auth-client-version: 0.3.3.0+version: 0.4.0.0 synopsis: servant-client/servant-auth compatibility description: This package provides instances that allow generating clients from <https://hackage.haskell.org/package/servant servant>@@ -15,7 +15,7 @@ copyright: (c) Julian K. Arni license: BSD3 license-file: LICENSE-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC==8.4.3+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC==8.4.4, GHC==8.6.2 build-type: Simple cabal-version: >= 1.10 extra-source-files:@@ -25,30 +25,18 @@ type: git location: https://github.com/haskell-servant/servant-auth -flag servant-client-core- description: Use servant-client-core- default: True- manual: False- library hs-source-dirs: src default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators ghc-options: -Wall build-depends:- base >= 4.8 && < 4.12- , text- , bytestring+ base >= 4.9 && < 4.13+ , bytestring >= 0.10.6.0 && < 0.11+ , containers >= 0.5.6.2 && < 0.7 , servant-auth == 0.3.*- , servant >= 0.7 && < 0.15- if flag(servant-client-core)- cpp-options: -DHAS_CLIENT_CORE=1- build-depends:- servant-client-core >= 0.12 && < 0.15,- containers- else- build-depends:- servant-client >= 0.7 && < 0.12+ , servant >= 0.13 && < 0.17+ , servant-client-core >= 0.13 && < 0.17 exposed-modules: Servant.Auth.Client@@ -62,7 +50,7 @@ test default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators ghc-options: -Wall- build-tool-depends: hspec-discover:hspec-discover+ build-tool-depends: hspec-discover:hspec-discover >=2.5.5 && <2.8 -- dependencies with bounds inherited from the library stanza build-depends:@@ -74,19 +62,19 @@ -- test dependencies build-depends:- hspec > 2 && < 3- , QuickCheck >= 2.8 && < 2.12- , aeson- , bytestring- , http-client- , http-types- , servant-auth-server- , servant-server- , time- , transformers- , wai- , warp- , jose+ hspec >= 2.5.5 && < 2.8+ , QuickCheck >= 2.11.3 && < 2.13+ , aeson >= 1.3.1.1 && < 1.5+ , bytestring >= 0.10.6.0 && < 0.11+ , http-client >= 0.5.13.1 && < 0.7+ , http-types >= 0.12.2 && < 0.13+ , servant-auth-server >= 0.4.2.0 && < 0.5+ , servant-server >= 0.13 && < 0.17+ , time >= 1.5.0.1 && < 1.9+ , transformers >= 0.4.2.0 && < 0.6+ , wai >= 3.2.1.2 && < 3.3+ , warp >= 3.2.25 && < 3.3+ , jose >= 0.7.0.0 && < 0.9 other-modules: Servant.Auth.ClientSpec default-language: Haskell2010
src/Servant/Auth/Client/Internal.hs view
@@ -16,14 +16,8 @@ import Servant.API ((:>)) import Servant.Auth -#ifdef HAS_CLIENT_CORE import Servant.Client.Core import Data.Sequence ((<|))-#else-import Servant.Client-import Servant.Common.Req (Req (..))-import qualified Data.Text.Encoding as T-#endif -- | A compact JWT Token. newtype Token = Token { getToken :: BS.ByteString }@@ -38,7 +32,6 @@ -- | @'HasJWT' auths@ is nominally a redundant constraint, but ensures we're not -- trying to send a token to an API that doesn't accept them.-#ifdef HAS_CLIENT_CORE instance (HasJWT auths, HasClient m api) => HasClient m (Auth auths a :> api) where type Client m (Auth auths a :> api) = Token -> Client m api @@ -50,17 +43,4 @@ #if MIN_VERSION_servant_client_core(0,14,0) hoistClientMonad pm _ nt cl = hoistClientMonad pm (Proxy :: Proxy api) nt . cl-#endif--#else-instance (HasJWT auths, HasClient api) => HasClient (Auth auths a :> api) where- type Client (Auth auths a :> api) = Token -> Client api-- clientWithRoute _ req (Token token)- = clientWithRoute (Proxy :: Proxy api)- $ req { headers = ("Authorization", headerVal):headers req }- where- -- 'servant-client' shouldn't be using a Text here; it should be using a- -- ByteString.- headerVal = "Bearer " <> T.decodeLatin1 token #endif
test/Servant/Auth/ClientSpec.hs view
@@ -16,8 +16,10 @@ import Network.Wai.Handler.Warp (testWithApplication) import Servant import Servant.Client (BaseUrl (..), Scheme (Http),- ServantError (FailureResponse),-#if MIN_VERSION_servant_client(0,13,0)+ ClientError (FailureResponse),+#if MIN_VERSION_servant_client(0,16,0)+ ResponseF(..),+#elif MIN_VERSION_servant_client(0,13,0) GenResponse(..), #elif MIN_VERSION_servant_client(0,12,0) Response(..),@@ -34,6 +36,9 @@ #else import Control.Monad.Trans.Except (runExceptT) #endif+#if !MIN_VERSION_servant_server(0,16,0)+#define ClientError ServantError+#endif import Servant.Auth.Client import Servant.Auth.Server@@ -67,7 +72,9 @@ it "fails when token is expired" $ \port -> property $ \user -> do tok <- mkTok user (Just past)-#if MIN_VERSION_servant_client(0,12,0)+#if MIN_VERSION_servant_client(0,16,0)+ Left (FailureResponse _ (Response stat _ _ _))+#elif MIN_VERSION_servant_client(0,12,0) Left (FailureResponse (Response stat _ _ _)) #elif MIN_VERSION_servant_client(0,11,0) Left (FailureResponse _ stat _ _)@@ -78,7 +85,7 @@ stat `shouldBe` status401 -getIntClient :: Token -> Manager -> BaseUrl -> IO (Either ServantError Int)+getIntClient :: Token -> Manager -> BaseUrl -> IO (Either ClientError Int) #if MIN_VERSION_servant(0,13,0) getIntClient tok m burl = runClientM (client api tok) (mkClientEnv m burl) #elif MIN_VERSION_servant(0,9,0)