Copyright | (c) Frederick Pringle 2025 |
---|---|
License | BSD-3-Clause |
Maintainer | freddyjepringle@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Servant.API.Routes.Auth
Description
Here we define a very very basic type to represent authentication schemes.
Synopsis
- data Auth
- basicAuth :: forall realm. KnownSymbol realm => Auth
- customAuth :: forall tag. KnownSymbol tag => Auth
Documentation
There are 2 variants:
- "Basic" authentication: corresponds to the
BasicAuth
type. Construct withbasicAuth
. - "Custom" authentication: corresponds to the
AuthProtect
type. Construct withcustomAuth
.
basicAuth :: forall realm. KnownSymbol realm => Auth Source #
Create a term-level representation of a "Basic" authentication scheme.
For example:
ghci> toJSON $ basicAuth @"user" String "Basic user"
customAuth :: forall tag. KnownSymbol tag => Auth Source #
Create a term-level representation of a "Custom" authentication scheme, i.e. one that
corresponds to Servant's AuthProtect
combinator.
For example:
ghci> toJSON $ customAuth @"OnlyAdminUsers" String "OnlyAdminUsers"