servant-auth 0.4.0.0 → 0.4.1.0
raw patch · 3 files changed
+25/−17 lines, 3 filesdep +containersdep ~aesondep ~basedep ~josenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: containers
Dependency ranges changed: aeson, base, jose, lens, servant, text
API changes (from Hackage documentation)
Files
- servant-auth.cabal +15/−14
- src/Servant/Auth.hs +1/−1
- src/Servant/Auth/JWT.hs +9/−2
servant-auth.cabal view
@@ -1,5 +1,6 @@+cabal-version: 2.2 name: servant-auth-version: 0.4.0.0+version: 0.4.1.0 synopsis: Authentication combinators for servant description: This package provides an @Auth@ combinator for 'servant'. This combinator allows using different authentication schemes in a straightforward way,@@ -8,36 +9,36 @@ 'servant-auth' additionally provides concrete authentication schemes, such as Basic Access Authentication, JSON Web Tokens, and Cookies. .- For more details on how to use this, see the <http://github.com/haskell-servant/servant-auth#readme README>.+ For more details on how to use this, see the <http://github.com/haskell-servant/servant/servant-auth#readme README>. category: Web, Servant, Authentication-homepage: http://github.com/haskell-servant/servant-auth#readme-bug-reports: https://github.com/haskell-servant/servant-auth/issues+homepage: http://github.com/haskell-servant/servant/servant-auth#readme+bug-reports: https://github.com/haskell-servant/servant/issues author: Julian K. Arni maintainer: jkarni@gmail.com copyright: (c) Julian K. Arni-license: BSD3+license: BSD-3-Clause license-file: LICENSE-tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1, GHC == 8.10.2+tested-with: GHC ==8.6.5 || ==8.8.4 || ==8.10.4 || ==9.0.1 build-type: Simple-cabal-version: >= 1.10 extra-source-files: CHANGELOG.md source-repository head type: git- location: https://github.com/haskell-servant/servant-auth+ location: https://github.com/haskell-servant/servant 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+ default-extensions: 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.10 && < 4.15- , aeson >= 1.3.1.1 && < 1.6- , jose >= 0.7.0.0 && < 0.9- , lens >= 4.16.1 && < 4.20- , servant >= 0.15 && < 0.19+ base >= 4.10 && < 4.16+ , containers >= 0.6 && < 0.7+ , aeson >= 1.3.1.1 && < 3+ , jose >= 0.7.0.0 && < 0.10+ , lens >= 4.16.1 && < 5.1+ , servant >= 0.15 && < 0.20 , text >= 1.2.3.0 && < 1.3 , unordered-containers >= 0.2.9.0 && < 0.3 exposed-modules:
src/Servant/Auth.hs view
@@ -29,7 +29,7 @@ -- | A JSON Web Token (JWT) in the the Authorization header: ----- @Authorization: Bearer <token>@+-- @Authorization: Bearer \<token\>@ -- -- Note that while the token is signed, it is not encrypted. Therefore do not -- keep in it any information you would not like the client to know.
src/Servant/Auth/JWT.hs view
@@ -1,10 +1,17 @@+{-# LANGUAGE CPP #-}+ module Servant.Auth.JWT where import Control.Lens ((^.)) import qualified Crypto.JWT as Jose import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON, toJSON)-import qualified Data.HashMap.Strict as HM+#if MIN_VERSION_aeson(2,0,0) +import qualified Data.Map as KM +#else +import qualified Data.HashMap.Strict as KM +#endif+ import qualified Data.Text as T @@ -17,7 +24,7 @@ class FromJWT a where decodeJWT :: Jose.ClaimsSet -> Either T.Text a default decodeJWT :: FromJSON a => Jose.ClaimsSet -> Either T.Text a- decodeJWT m = case HM.lookup "dat" (m ^. Jose.unregisteredClaims) of+ decodeJWT m = case KM.lookup "dat" (m ^. Jose.unregisteredClaims) of Nothing -> Left "Missing 'dat' claim" Just v -> case fromJSON v of Error e -> Left $ T.pack e