servant-auth-docs-0.2.10.1: servant-docs/servant-auth compatibility
Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.Auth.Docs

Synopsis

Documentation

The purpose of this package is provide the instance for 'servant-auth' combinators needed for 'servant-docs' documentation generation.

>>> type API = Auth '[JWT, Cookie, BasicAuth] Int :> Get '[JSON] Int
>>> putStr $ markdown $ docs (Proxy :: Proxy API)
## GET /
...
... Authentication
...
This part of the API is protected by the following authentication mechanisms:
...
 * JSON Web Tokens ([JWTs](https://en.wikipedia.org/wiki/JSON_Web_Token))
 * [Cookies](https://en.wikipedia.org/wiki/HTTP_cookie)
 * [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication)
...
Clients must supply the following data
...
One of the following:
...
 * A JWT Token signed with this server's key
 * Cookies automatically set by browsers, plus a header
 * Cookies automatically set by browsers, plus a header
...

Re-export

data JWT #

A JSON Web Token (JWT) in the the Authorization header:

Authorization: Bearer <token>

Note that while the token is signed, it is not encrypted. Therefore do not keep in it any information you would not like the client to know.

JWTs are described in IETF's RFC 7519

data BasicAuth #

Basic Auth.

data Cookie #

A cookie. The content cookie itself is a JWT. Another cookie is also used, the contents of which are expected to be send back to the server in a header, for XSRF protection.

data Auth (auths :: [Type]) val #

Auth [auth1, auth2] val :> api represents an API protected *either* by auth1 or auth2

Instances

Instances details
HasLink sub => HasLink (Auth tag value :> sub :: Type)

A HasLink instance for Auth

Instance details

Defined in Servant.Auth

Associated Types

type MkLink (Auth tag value :> sub) a #

Methods

toLink :: (Link -> a) -> Proxy (Auth tag value :> sub) -> Link -> MkLink (Auth tag value :> sub) a #

(AllDocs auths, HasDocs api) => HasDocs (Auth auths r :> api :: Type) Source # 
Instance details

Defined in Servant.Auth.Docs

Methods

docsFor :: Proxy (Auth auths r :> api) -> (Endpoint, Action) -> DocOptions -> API #

type MkLink (Auth tag value :> sub :: Type) a 
Instance details

Defined in Servant.Auth

type MkLink (Auth tag value :> sub :: Type) a = MkLink sub a

Orphan instances

(AllDocs auths, HasDocs api) => HasDocs (Auth auths r :> api :: Type) Source # 
Instance details

Methods

docsFor :: Proxy (Auth auths r :> api) -> (Endpoint, Action) -> DocOptions -> API #