Incorporate new GADT-based auth into servant-docs
This commit is contained in:
parent
ae510791dd
commit
71d5debdf1
2 changed files with 6 additions and 6 deletions
|
@ -75,7 +75,7 @@ instance ToSample Cookie where
|
||||||
instance ToSample SecretData where
|
instance ToSample SecretData where
|
||||||
toSamples _ = singleSample (SecretData "shhhhh!")
|
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."
|
toAuthInfo _ = AuthenticationInfo "In this sentence we outline how authentication works."
|
||||||
"The following data is required on each request as a serialized header."
|
"The following data is required on each request as a serialized header."
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ type TestApi =
|
||||||
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
|
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
|
||||||
|
|
||||||
-- GET /private
|
-- GET /private
|
||||||
:<|> "private" :> AuthProtect Cookie User 'Strict :> Get '[JSON] SecretData
|
:<|> "private" :> AuthProtect Cookie User 'Strict () 'Strict () :> Get '[JSON] SecretData
|
||||||
-- GET /private-lax
|
-- 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 TestApi
|
||||||
testApi = Proxy
|
testApi = Proxy
|
||||||
|
|
|
@ -727,14 +727,14 @@ instance
|
||||||
( HasDocs sublayout
|
( HasDocs sublayout
|
||||||
, ToSample auth
|
, ToSample auth
|
||||||
, ToSample usr
|
, 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 (endpoint, action) =
|
||||||
docsFor (Proxy :: Proxy sublayout) (endpoint, action')
|
docsFor (Proxy :: Proxy sublayout) (endpoint, action')
|
||||||
|
|
||||||
where
|
where
|
||||||
authProxy = Proxy :: Proxy (AuthProtect auth usr policy)
|
authProxy = Proxy :: Proxy (AuthProtect auth usr mPolicy mError uPolicy uError)
|
||||||
action' = over authInfo (|> toAuthInfo authProxy) action
|
action' = over authInfo (|> toAuthInfo authProxy) action
|
||||||
|
|
||||||
instance
|
instance
|
||||||
|
|
Loading…
Reference in a new issue