Clean up basic-auth example

This commit is contained in:
aaron levin 2016-01-27 19:39:10 +01:00
parent dc464fa480
commit 78da8e9a77

View file

@ -15,8 +15,13 @@ 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 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