servant-auth-server 0.4.4.0 → 0.4.5.0
raw patch · 5 files changed
+35/−17 lines, 5 filesdep ~basedep ~lensdep ~lens-aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, lens, lens-aeson, memory, semigroups, time, warp
API changes (from Hackage documentation)
+ Servant.Auth.Server.Internal.Types: instance Control.Monad.Fail.MonadFail Servant.Auth.Server.Internal.Types.AuthCheck
Files
- CHANGELOG.md +11/−0
- README.lhs +1/−1
- servant-auth-server.cabal +10/−10
- src/Servant/Auth/Server/Internal.hs +3/−5
- src/Servant/Auth/Server/Internal/Types.hs +10/−1
CHANGELOG.md view
@@ -7,6 +7,17 @@ ## [Unreleased] +## [0.4.5.0] - 2019-12-28++## Changed+- #144 servant 0.16 support and drop GHC 7.10 support [@domenkozar]+- #148 removed unused constaint in HasServer instance for Auth +- #154 GHC 8.8 support [@phadej]++### Added+- #141 Support Stream combinator [@domenkozar]+- #143 Allow servant-0.16 [@phadej]+ ## [0.4.4.0] - 2019-03-02 ### Added
README.lhs view
@@ -243,7 +243,7 @@ a distinguished cookie that is set by the server on each request. What the cookie and header name are can be configured (see `xsrfCookieName` and `xsrfHeaderName` in `CookieSettings`), but by default they are "XSRF-TOKEN" and-"X-XSRF-TOKEN". This means that, if your client is a browser and your are using+"X-XSRF-TOKEN". This means that, if your client is a browser and you're using cookies, Javascript on the client must set the header of each request by reading the cookie. For jQuery, and with the default values, that might be:
servant-auth-server.cabal view
@@ -1,5 +1,5 @@ name: servant-auth-server-version: 0.4.4.0+version: 0.4.5.0 synopsis: servant-server/servant-auth compatibility description: This package provides the required instances for using the @Auth@ combinator in your 'servant' server.@@ -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.4, GHC == 8.6.2+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.1 build-type: Simple cabal-version: >= 1.10 extra-source-files:@@ -31,7 +31,7 @@ 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.13+ base >= 4.9 && < 4.14 , aeson >= 1.3.1.1 && < 1.5 , base64-bytestring >= 1.0.0.1 && < 1.1 , blaze-builder >= 0.4.1.0 && < 0.5@@ -42,8 +42,8 @@ , entropy >= 0.4.1.3 && < 0.5 , http-types >= 0.12.2 && < 0.13 , jose >= 0.7.0.0 && < 0.9- , lens >= 4.16.1 && < 4.18- , memory >= 0.14.16 && < 0.15+ , lens >= 4.16.1 && < 4.19+ , memory >= 0.14.16 && < 0.16 , monad-time >= 0.3.1.0 && < 0.4 , mtl >= 2.2.2 && < 2.3 , servant >= 0.13 && < 0.17@@ -51,12 +51,12 @@ , servant-server >= 0.13 && < 0.17 , tagged >= 0.8.4 && < 0.9 , text >= 1.2.3.0 && < 1.3- , time >= 1.5.0.1 && < 1.9+ , time >= 1.5.0.1 && < 1.10 , unordered-containers >= 0.2.9.0 && < 0.3 , wai >= 3.2.1.2 && < 3.3 if !impl(ghc >= 8.0) build-depends:- semigroups >= 0.18.5 && <0.19+ semigroups >= 0.18.5 && <0.20 exposed-modules: Servant.Auth.Server Servant.Auth.Server.Internal@@ -119,10 +119,10 @@ build-depends: servant-auth-server , hspec >= 2.5.5 && < 2.8- , QuickCheck >= 2.11.3 && < 2.13+ , QuickCheck >= 2.11.3 && < 2.14 , http-client >= 0.5.13.1 && < 0.7- , lens-aeson >= 1.0.2 && < 1.1- , warp >= 3.2.25 && < 3.3+ , lens-aeson >= 1.0.2 && < 1.2+ , warp >= 3.2.25 && < 3.4 , wreq >= 0.5.2.1 && < 0.6 other-modules: Servant.Auth.ServerSpec
src/Servant/Auth/Server/Internal.hs view
@@ -63,9 +63,7 @@ Just jwt -> return $ Just jwt `SetCookieCons` SetCookieNil _ -> return $ Nothing `SetCookieCons` SetCookieNil - go :: ( old ~ ServerT api Handler- , new ~ ServerT (AddSetCookiesApi n api) Handler- )- => (AuthResult v -> ServerT api Handler)- -> (AuthResult v, SetCookieList n) -> new+ go :: (AuthResult v -> ServerT api Handler)+ -> (AuthResult v, SetCookieList n)+ -> ServerT (AddSetCookiesApi n api) Handler go fn (authResult, cookies) = addSetCookies cookies $ fn authResult
src/Servant/Auth/Server/Internal/Types.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Servant.Auth.Server.Internal.Types where import Control.Applicative@@ -9,6 +10,8 @@ import GHC.Generics (Generic) import Network.Wai (Request) +import qualified Control.Monad.Fail as Fail+ -- | The result of an authentication attempt. data AuthResult val = BadPassword@@ -75,7 +78,6 @@ instance Monad AuthCheck where return = AuthCheck . return . return . return- fail _ = AuthCheck . const $ return Indefinite AuthCheck ac >>= f = AuthCheck $ \req -> do aresult <- ac req case aresult of@@ -83,6 +85,13 @@ BadPassword -> return BadPassword NoSuchUser -> return NoSuchUser Indefinite -> return Indefinite++#if !MIN_VERSION_base(4,13,0)+ fail = Fail.fail+#endif++instance Fail.MonadFail AuthCheck where+ fail _ = AuthCheck . const $ return Indefinite instance MonadReader Request AuthCheck where ask = AuthCheck $ \x -> return (Authenticated x)