Add Experimental warnings on combinators
This commit is contained in:
parent
cd31b20cd8
commit
29f8e64e1c
4 changed files with 14 additions and 1 deletions
|
@ -15,15 +15,21 @@ import Servant.Common.Req (Req)
|
||||||
-- | For a resource protected by authentication (e.g. AuthProtect), we need
|
-- | For a resource protected by authentication (e.g. AuthProtect), we need
|
||||||
-- to provide the client with some data used to add authentication data
|
-- to provide the client with some data used to add authentication data
|
||||||
-- to a request
|
-- to a request
|
||||||
|
--
|
||||||
|
-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
|
||||||
type family AuthClientData a :: *
|
type family AuthClientData a :: *
|
||||||
|
|
||||||
-- | For better type inference and to avoid usage of a data family, we newtype
|
-- | For better type inference and to avoid usage of a data family, we newtype
|
||||||
-- wrap the combination of some 'AuthClientData' and a function to add authentication
|
-- wrap the combination of some 'AuthClientData' and a function to add authentication
|
||||||
-- data to a request
|
-- data to a request
|
||||||
|
--
|
||||||
|
-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
|
||||||
newtype AuthenticateReq a =
|
newtype AuthenticateReq a =
|
||||||
AuthenticateReq { unAuthReq :: (AuthClientData a, AuthClientData a -> Req -> Req) }
|
AuthenticateReq { unAuthReq :: (AuthClientData a, AuthClientData a -> Req -> Req) }
|
||||||
|
|
||||||
-- | Handy helper to avoid wrapping datatypes in tuples everywhere.
|
-- | Handy helper to avoid wrapping datatypes in tuples everywhere.
|
||||||
|
--
|
||||||
|
-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
|
||||||
mkAuthenticateReq :: AuthClientData a
|
mkAuthenticateReq :: AuthClientData a
|
||||||
-> (AuthClientData a -> Req -> Req)
|
-> (AuthClientData a -> Req -> Req)
|
||||||
-> AuthenticateReq a
|
-> AuthenticateReq a
|
||||||
|
|
|
@ -16,12 +16,17 @@ import Servant.Server.Internal.ServantErr (ServantErr)
|
||||||
|
|
||||||
-- | Specify the type of data returned after we've authenticated a request.
|
-- | Specify the type of data returned after we've authenticated a request.
|
||||||
-- quite often this is some `User` datatype.
|
-- quite often this is some `User` datatype.
|
||||||
|
--
|
||||||
|
-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
|
||||||
type family AuthServerData a :: *
|
type family AuthServerData a :: *
|
||||||
|
|
||||||
-- | Handlers for AuthProtected resources
|
-- | Handlers for AuthProtected resources
|
||||||
|
--
|
||||||
|
-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
|
||||||
newtype AuthHandler r usr = AuthHandler
|
newtype AuthHandler r usr = AuthHandler
|
||||||
{ unAuthHandler :: r -> ExceptT ServantErr IO usr }
|
{ unAuthHandler :: r -> ExceptT ServantErr IO usr }
|
||||||
deriving (Generic, Typeable)
|
deriving (Generic, Typeable)
|
||||||
|
|
||||||
|
-- | NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
|
||||||
mkAuthHandler :: (r -> ExceptT ServantErr IO usr) -> AuthHandler r usr
|
mkAuthHandler :: (r -> ExceptT ServantErr IO usr) -> AuthHandler r usr
|
||||||
mkAuthHandler = AuthHandler
|
mkAuthHandler = AuthHandler
|
||||||
|
|
|
@ -26,7 +26,6 @@ source-repository head
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
Servant.API
|
Servant.API
|
||||||
Servant.API.Auth
|
|
||||||
Servant.API.Alternative
|
Servant.API.Alternative
|
||||||
Servant.API.BasicAuth
|
Servant.API.BasicAuth
|
||||||
Servant.API.Capture
|
Servant.API.Capture
|
||||||
|
@ -44,6 +43,7 @@ library
|
||||||
Servant.API.Vault
|
Servant.API.Vault
|
||||||
Servant.API.Verbs
|
Servant.API.Verbs
|
||||||
Servant.API.WithNamedContext
|
Servant.API.WithNamedContext
|
||||||
|
Servant.API.Experimental.Auth
|
||||||
Servant.Utils.Links
|
Servant.Utils.Links
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.7 && <5
|
base >=4.7 && <5
|
||||||
|
|
|
@ -8,5 +8,7 @@ import Data.Typeable (Typeable)
|
||||||
|
|
||||||
-- | A generalized Authentication combinator. Use this if you have a
|
-- | A generalized Authentication combinator. Use this if you have a
|
||||||
-- non-standard authentication technique.
|
-- non-standard authentication technique.
|
||||||
|
--
|
||||||
|
-- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE.
|
||||||
data AuthProtect (tag :: k) deriving (Typeable)
|
data AuthProtect (tag :: k) deriving (Typeable)
|
||||||
|
|
Loading…
Reference in a new issue