@@ -44,7 +44,7 @@ You can use this combinator to protect an API as follows:
4444
4545module Authentication where
4646
47−import Control.Monad.Trans.Except (ExceptT, throwE)
47+import Control.Monad.Trans.Except (ExceptT)
4848import Data.Aeson (ToJSON)
4949import Data.ByteString (ByteString)
5050import Data.Map (Map, fromList)
@@ -59,6 +59,7 @@ import Servant.API ((:<|>) ((:<|>)), (:>), BasicAuth,
5959 Get, JSON)
6060import Servant.API.BasicAuth (BasicAuthData (BasicAuthData))
6161import Servant.API.Experimental.Auth (AuthProtect)
62+import Servant (throwError)
6263import Servant.Server (BasicAuthCheck (BasicAuthCheck),
6364 BasicAuthResult( Authorized
6465 , Unauthorized
@@ -173,7 +174,7 @@ And now we create the `Context` used by servant to find `BasicAuthCheck`:
173174```haskell
174175-- | We need to supply our handlers with the right Context. In this case,
175176-- Basic Authentication requires a Context Entry with the 'BasicAuthCheck' value
176−-- tagged with "foo-tag" This context is then supplied to 'server' and threaded
177+-- tagged with "foo-tag" This context is then supplied to 'server' and threaded
177178-- to the BasicAuth HasServer handlers.
178179basicAuthServerContext :: Context (BasicAuthCheck User ': '[])
179180basicAuthServerContext = authCheck :. EmptyContext
@@ -274,7 +275,7 @@ database = fromList [ ("key1", Account "Anne Briggs")
274275-- This is our bespoke (and bad) authentication logic.
275276lookupAccount :: ByteString -> ExceptT ServantErr IO Account
276277lookupAccount key = case Map.lookup key database of
277− Nothing -> throwE (err403 { errBody = "Invalid Cookie" })
278+ Nothing -> throwError (err403 { errBody = "Invalid Cookie" })
278279 Just usr -> return usr
279280```
280281
@@ -289,7 +290,7 @@ method:
289290authHandler :: AuthHandler Request Account
290291authHandler =
291292 let handler req = case lookup "servant-auth-cookie" (requestHeaders req) of
292− Nothing -> throwE (err401 { errBody = "Missing auth header" })
293+ Nothing -> throwError (err401 { errBody = "Missing auth header" })
293294 Just authCookieKey -> lookupAccount authCookieKey
294295 in mkAuthHandler handler
295296```
@@ -329,7 +330,7 @@ We now construct the `Context` for our server, allowing us to instantiate a
329330value of type `Server AuthGenAPI`, in addition to the server value:
330331
331332```haskell
332−-- | The context that will be made available to request handlers. We supply the
333+-- | The context that will be made available to request handlers. We supply the
333334-- "cookie-auth"-tagged request handler defined above, so that the 'HasServer' instance
334335-- of 'AuthProtect' can extract the handler and run it on the request.
335336genAuthServerContext :: Context (AuthHandler Request Account ': '[])