servant-routes
Copyright(c) Frederick Pringle 2025
LicenseBSD-3-Clause
Maintainerfrederick.pringle@fpringle.com
Safe HaskellNone
LanguageHaskell2010

Servant.API.Routes.Auth

Description

Here we define a very very basic type to represent authentication schemes.

Synopsis

Documentation

data Auth Source #

There are 2 variants:

Instances

Instances details
ToJSON Auth Source # 
Instance details

Defined in Servant.API.Routes.Internal.Auth

Show Auth Source # 
Instance details

Defined in Servant.API.Routes.Internal.Auth

Methods

showsPrec :: Int -> Auth -> ShowS #

show :: Auth -> String #

showList :: [Auth] -> ShowS #

Eq Auth Source # 
Instance details

Defined in Servant.API.Routes.Internal.Auth

Methods

(==) :: Auth -> Auth -> Bool #

(/=) :: Auth -> Auth -> Bool #

Ord Auth Source # 
Instance details

Defined in Servant.API.Routes.Internal.Auth

Methods

compare :: Auth -> Auth -> Ordering #

(<) :: Auth -> Auth -> Bool #

(<=) :: Auth -> Auth -> Bool #

(>) :: Auth -> Auth -> Bool #

(>=) :: Auth -> Auth -> Bool #

max :: Auth -> Auth -> Auth #

min :: Auth -> Auth -> Auth #

basicAuth :: forall (realm :: Symbol). 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 :: Symbol). 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"