From 78da8e9a77483be31ed62e37c0510b6e17809ac9 Mon Sep 17 00:00:00 2001 From: aaron levin Date: Wed, 27 Jan 2016 19:39:10 +0100 Subject: [PATCH] Clean up basic-auth example --- servant-examples/basic-auth/basic-auth.hs | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/servant-examples/basic-auth/basic-auth.hs b/servant-examples/basic-auth/basic-auth.hs index 0ee22666..07715794 100644 --- a/servant-examples/basic-auth/basic-auth.hs +++ b/servant-examples/basic-auth/basic-auth.hs @@ -7,16 +7,21 @@ module Main where -import Data.Aeson (ToJSON) -import Data.Proxy (Proxy (Proxy)) -import Data.Text (Text) -import GHC.Generics (Generic) -import Network.Wai.Handler.Warp (run) -import Servant.API ((:<|>) ((:<|>)), (:>), BasicAuth, - Get, JSON) -import Servant.API.Auth (BasicAuthData(BasicAuthData)) -import Servant.Server (AuthReturnType, BasicAuthResult (Authorized, Unauthorized), Config ((:.), EmptyConfig), - Server, serve, BasicAuthCheck(BasicAuthCheck)) +import Data.Aeson (ToJSON) +import Data.Proxy (Proxy (Proxy)) +import Data.Text (Text) +import GHC.Generics (Generic) +import Network.Wai.Handler.Warp (run) +import Servant.API ((:<|>) ((:<|>)), (:>), BasicAuth, + Get, JSON) +import Servant.API.Auth (BasicAuthData (BasicAuthData)) +import Servant.Server (AuthReturnType, + BasicAuthCheck (BasicAuthCheck), + BasicAuthResult( Authorized + , Unauthorized + ), + Config ((:.), EmptyConfig), Server, + serve) -- | let's define some types that our API returns. @@ -50,10 +55,6 @@ type API = "public" :> PublicAPI api :: Proxy API api = Proxy --- | a value holding a proxy of our basic auth realm. -authRealm :: Proxy "foo-realm" -authRealm = Proxy - -- | Specify the data type returned after performing basic authentication type instance AuthReturnType (BasicAuth "foo-realm") = User