Update Authentication.lhs

This commit is contained in:
Ruben Moor 2016-10-14 15:06:49 +02:00 committed by Sönke Hahn
parent 3ddf225cec
commit f352f3b136

View file

@ -409,13 +409,15 @@ marshal an unauthenticated request into an authenticated request. Generally,
this will look like: this will look like:
```haskell ignore ```haskell ignore
import Servant.Common.Req (Req, addHeader)
-- | The datatype we'll use to authenticate a request. If we were wrapping -- | The datatype we'll use to authenticate a request. If we were wrapping
-- something like OAuth, this might be a Bearer token. -- something like OAuth, this might be a Bearer token.
type instance AuthClientData (AuthProtect "cookie-auth") = String type instance AuthClientData (AuthProtect "cookie-auth") = String
-- | A method to authenticate a request -- | A method to authenticate a request
authenticateReq :: String -> Req -> Req authenticateReq :: String -> Req -> Req
authenticateReq s req = SCR.addHeader "my-bespoke-header" s req authenticateReq s req = addHeader "my-bespoke-header" s req
``` ```
Now, if the client method for our protected endpoint was `getProtected`, then Now, if the client method for our protected endpoint was `getProtected`, then