From 57698229c53a499dfecbae446b9c96154e8d0d1b Mon Sep 17 00:00:00 2001 From: Arian van Putten Date: Sun, 4 Oct 2015 23:24:04 +0200 Subject: [PATCH] digest auth example was accidentally commited --- servant-examples/digest-auth/digest-auth.hs | 33 --------------------- 1 file changed, 33 deletions(-) delete mode 100644 servant-examples/digest-auth/digest-auth.hs diff --git a/servant-examples/digest-auth/digest-auth.hs b/servant-examples/digest-auth/digest-auth.hs deleted file mode 100644 index ff36c6da..00000000 --- a/servant-examples/digest-auth/digest-auth.hs +++ /dev/null @@ -1,33 +0,0 @@ -{-#LANGUAGE DataKinds, TypeOperators, OverloadedStrings #-} -module Main where - -import Data.Text -import Data.ByteString (ByteString) -import Data.Proxy -import Servant.API -import Servant.API.Authentication -import Servant.Server -import Servant.Server.Internal.Authentication -import Network.Wai.Handler.Warp - - -data User = User - { username :: ByteString - , ha1 :: ByteString -- ^ MD5(username:realm:password) - } - - --- | A table with just one user. namely "username:foo:password" -table = [("username", User "username" "22f93fe54b9edf660a2f85310adc8a56")] - -type API = AuthProtect (DigestAuth "foo") User 'Strict :> "foo" :> Get '[JSON] Text - -api :: Server API -api = digestAuthStrict ha1 lookupUser (const . return $ "hello") - -lookupUser :: DigestAuth "foo" -> IO (Maybe User) -lookupUser authData = return . lookup (daUsername authData) $ table - - -main :: IO () -main = run 8080 (serve (Proxy :: Proxy API) api)