on master help sign in
Add Experimental warnings on combinators
29f8e64aaron levin
servant-client/src/Servant/Common/Auth.hs+6
@@ -15,15 +15,21 @@ import Servant.Common.Req (Req)
15-- | For a resource protected by authentication (e.g. AuthProtect), we need
15-- | For a resource protected by authentication (e.g. AuthProtect), we need
16-- to provide the client with some data used to add authentication data
16-- to provide the client with some data used to add authentication data
17-- to a request
17-- to a request
18+--
19+-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
18type family AuthClientData a :: *
20type family AuthClientData a :: *
19
21
20-- | For better type inference and to avoid usage of a data family, we newtype
22-- | For better type inference and to avoid usage of a data family, we newtype
21-- wrap the combination of some 'AuthClientData' and a function to add authentication
23-- wrap the combination of some 'AuthClientData' and a function to add authentication
22-- data to a request
24-- data to a request
25+--
26+-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
23newtype AuthenticateReq a =
27newtype AuthenticateReq a =
24 AuthenticateReq { unAuthReq :: (AuthClientData a, AuthClientData a -> Req -> Req) }
28 AuthenticateReq { unAuthReq :: (AuthClientData a, AuthClientData a -> Req -> Req) }
25
29
26-- | Handy helper to avoid wrapping datatypes in tuples everywhere.
30-- | Handy helper to avoid wrapping datatypes in tuples everywhere.
31+--
32+-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
27mkAuthenticateReq :: AuthClientData a
33mkAuthenticateReq :: AuthClientData a
28 -> (AuthClientData a -> Req -> Req)
34 -> (AuthClientData a -> Req -> Req)
29 -> AuthenticateReq a
35 -> AuthenticateReq a
servant-server/src/Servant/Server/Internal/Auth.hs+5
@@ -16,12 +16,17 @@ import Servant.Server.Internal.ServantErr (ServantErr)
16
16
17-- | Specify the type of data returned after we've authenticated a request.
17-- | Specify the type of data returned after we've authenticated a request.
18-- quite often this is some `User` datatype.
18-- quite often this is some `User` datatype.
19+--
20+-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
19type family AuthServerData a :: *
21type family AuthServerData a :: *
20
22
21-- | Handlers for AuthProtected resources
23-- | Handlers for AuthProtected resources
24+--
25+-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
22newtype AuthHandler r usr = AuthHandler
26newtype AuthHandler r usr = AuthHandler
23 { unAuthHandler :: r -> ExceptT ServantErr IO usr }
27 { unAuthHandler :: r -> ExceptT ServantErr IO usr }
24 deriving (Generic, Typeable)
28 deriving (Generic, Typeable)
25
29
30+-- | NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
26mkAuthHandler :: (r -> ExceptT ServantErr IO usr) -> AuthHandler r usr
31mkAuthHandler :: (r -> ExceptT ServantErr IO usr) -> AuthHandler r usr
27mkAuthHandler = AuthHandler
32mkAuthHandler = AuthHandler
servant/servant.cabal+1−1
@@ -26,7 +26,6 @@ source-repository head
26library
26library
27 exposed-modules:
27 exposed-modules:
28 Servant.API
28 Servant.API
29− Servant.API.Auth
30 Servant.API.Alternative
29 Servant.API.Alternative
31 Servant.API.BasicAuth
30 Servant.API.BasicAuth
32 Servant.API.Capture
31 Servant.API.Capture
@@ -44,6 +43,7 @@ library
44 Servant.API.Vault
43 Servant.API.Vault
45 Servant.API.Verbs
44 Servant.API.Verbs
46 Servant.API.WithNamedContext
45 Servant.API.WithNamedContext
46+ Servant.API.Experimental.Auth
47 Servant.Utils.Links
47 Servant.Utils.Links
48 build-depends:
48 build-depends:
49 base >=4.7 && <5
49 base >=4.7 && <5
servant/src/Servant/API/Auth.hs → servant/src/Servant/Experimental/API/Auth.hsrenamed+2
@@ -8,5 +8,7 @@ import Data.Typeable (Typeable)
8
8
9-- | A generalized Authentication combinator. Use this if you have a
9-- | A generalized Authentication combinator. Use this if you have a
10-- non-standard authentication technique.
10-- non-standard authentication technique.
11+--
12+-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE.
11data AuthProtect (tag :: k) deriving (Typeable)
13data AuthProtect (tag :: k) deriving (Typeable)
12
14