Incorporate new GADT-based auth into servant-docs

This commit is contained in:
aaron levin 2015-12-24 21:53:51 +01:00
parent ae510791dd
commit 71d5debdf1
2 changed files with 6 additions and 6 deletions

View file

@ -75,7 +75,7 @@ instance ToSample Cookie where
instance ToSample SecretData where
toSamples _ = singleSample (SecretData "shhhhh!")
instance ToAuthInfo (AuthProtect Cookie User policy) where
instance ToAuthInfo (AuthProtect Cookie User mP mE uP uE) where
toAuthInfo _ = AuthenticationInfo "In this sentence we outline how authentication works."
"The following data is required on each request as a serialized header."
@ -108,9 +108,9 @@ type TestApi =
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
-- GET /private
:<|> "private" :> AuthProtect Cookie User 'Strict :> Get '[JSON] SecretData
:<|> "private" :> AuthProtect Cookie User 'Strict () 'Strict () :> Get '[JSON] SecretData
-- GET /private-lax
:<|> "private-lax" :> AuthProtect Cookie User 'Lax :> Get '[JSON] SecretData
:<|> "private-lax" :> AuthProtect Cookie User 'Lax () 'Lax () :> Get '[JSON] SecretData
testApi :: Proxy TestApi
testApi = Proxy

View file

@ -727,14 +727,14 @@ instance
( HasDocs sublayout
, ToSample auth
, ToSample usr
, ToAuthInfo (AuthProtect auth usr policy)
, ToAuthInfo (AuthProtect auth usr mPolicy mError uPolicy uError)
)
=> HasDocs (AuthProtect auth usr policy :> sublayout) where
=> HasDocs (AuthProtect auth usr mPolicy mError uPolicy uError :> sublayout) where
docsFor Proxy (endpoint, action) =
docsFor (Proxy :: Proxy sublayout) (endpoint, action')
where
authProxy = Proxy :: Proxy (AuthProtect auth usr policy)
authProxy = Proxy :: Proxy (AuthProtect auth usr mPolicy mError uPolicy uError)
action' = over authInfo (|> toAuthInfo authProxy) action
instance