Update Authentication.lhs
This commit is contained in:
parent
3ddf225cec
commit
f352f3b136
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue