{-# OPTIONS_HADDOCK not-home #-}
module Servant.API.Routes.Internal.Auth
( Auth (..)
)
where
import Data.Aeson
import qualified Data.Text as T
data Auth
= Basic T.Text
| Custom T.Text
deriving (Int -> Auth -> ShowS
[Auth] -> ShowS
Auth -> String
(Int -> Auth -> ShowS)
-> (Auth -> String) -> ([Auth] -> ShowS) -> Show Auth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Auth -> ShowS
showsPrec :: Int -> Auth -> ShowS
$cshow :: Auth -> String
show :: Auth -> String
$cshowList :: [Auth] -> ShowS
showList :: [Auth] -> ShowS
Show, Auth -> Auth -> Bool
(Auth -> Auth -> Bool) -> (Auth -> Auth -> Bool) -> Eq Auth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Auth -> Auth -> Bool
== :: Auth -> Auth -> Bool
$c/= :: Auth -> Auth -> Bool
/= :: Auth -> Auth -> Bool
Eq, Eq Auth
Eq Auth =>
(Auth -> Auth -> Ordering)
-> (Auth -> Auth -> Bool)
-> (Auth -> Auth -> Bool)
-> (Auth -> Auth -> Bool)
-> (Auth -> Auth -> Bool)
-> (Auth -> Auth -> Auth)
-> (Auth -> Auth -> Auth)
-> Ord Auth
Auth -> Auth -> Bool
Auth -> Auth -> Ordering
Auth -> Auth -> Auth
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Auth -> Auth -> Ordering
compare :: Auth -> Auth -> Ordering
$c< :: Auth -> Auth -> Bool
< :: Auth -> Auth -> Bool
$c<= :: Auth -> Auth -> Bool
<= :: Auth -> Auth -> Bool
$c> :: Auth -> Auth -> Bool
> :: Auth -> Auth -> Bool
$c>= :: Auth -> Auth -> Bool
>= :: Auth -> Auth -> Bool
$cmax :: Auth -> Auth -> Auth
max :: Auth -> Auth -> Auth
$cmin :: Auth -> Auth -> Auth
min :: Auth -> Auth -> Auth
Ord)
instance ToJSON Auth where
toJSON :: Auth -> Value
toJSON =
forall a. ToJSON a => a -> Value
toJSON @T.Text (Text -> Value) -> (Auth -> Text) -> Auth -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
Basic Text
realm -> Text
"Basic " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
realm
Custom Text
tag -> Text
tag