Small haddocks changes for authentication

This commit is contained in:
aaron levin 2015-08-12 20:20:18 -04:00 committed by aaron levin
parent 5bbedb838d
commit c7da1ba9dc
2 changed files with 11 additions and 20 deletions

View file

@ -1,19 +1,13 @@
{-# LANGUAGE DataKinds #-} -- | An example of a custom authentication framework that checks a Cookie for a
{-# LANGUAGE DeriveGeneric #-} -- value.
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
import Data.Aeson {-# LANGUAGE DataKinds #-}
import Data.ByteString (ByteString) {-# LANGUAGE TypeFamilies #-}
import Data.Text (Text) {-# LANGUAGE DeriveGeneric #-}
import GHC.Generics {-# LANGUAGE TypeOperators #-}
import Network.Wai {-# LANGUAGE FlexibleInstances #-}
import Network.Wai.Handler.Warp {-# LANGUAGE OverloadedStrings #-}
import Servant {-# LANGUAGE ScopedTypeVariables #-}
import Servant.Server.Internal
import Data.Aeson import Data.Aeson
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import Data.ByteString.Builder.Internal (byteStringCopy) import Data.ByteString.Builder.Internal (byteStringCopy)
@ -28,9 +22,6 @@ import Servant.API.Authentication
import Servant.Server.Internal import Servant.Server.Internal
import Servant.Server.Internal.Authentication (strictProtect, AuthHandlers(AuthHandlers)) import Servant.Server.Internal.Authentication (strictProtect, AuthHandlers(AuthHandlers))
-- | An example of a custom authentication framework that checks a Cookie for a
-- value.
-- | Data we will use to test for authentication -- | Data we will use to test for authentication
data CookieAuth = CookieAuth { cookie :: ByteString } data CookieAuth = CookieAuth { cookie :: ByteString }

View file

@ -60,13 +60,13 @@ data instance AuthProtected authData usr subserver 'Lax =
, subServerLax :: subserver , subServerLax :: subserver
} }
-- | handy function to build an auth-protected bit of API with a Lax policy -- | handy function to build an auth-protected bit of API with a 'Lax' policy
laxProtect :: (authData -> IO (Maybe usr)) -- ^ check auth laxProtect :: (authData -> IO (Maybe usr)) -- ^ check auth
-> subserver -- ^ the handlers for the auth-aware bits of the API -> subserver -- ^ the handlers for the auth-aware bits of the API
-> AuthProtected authData usr subserver 'Lax -> AuthProtected authData usr subserver 'Lax
laxProtect = AuthProtectedLax laxProtect = AuthProtectedLax
-- | handy function to build an auth-protected bit of API with a Strict policy -- | handy function to build an auth-protected bit of API with a 'Strict' policy
strictProtect :: (authData -> IO (Maybe usr)) -- ^ check auth strictProtect :: (authData -> IO (Maybe usr)) -- ^ check auth
-> AuthHandlers authData -- ^ functions to call on auth failure -> AuthHandlers authData -- ^ functions to call on auth failure
-> subserver -- ^ handlers for the auth-protected bits of the API -> subserver -- ^ handlers for the auth-protected bits of the API