module OpenID.Connect.Authentication
( ClientAuthentication(..)
, ClientSecret(..)
, Credentials(..)
, ClientID
, ClientRedirectURI
, AuthenticationRequest(..)
) where
import Crypto.JOSE.JWK (JWK)
import Data.ByteString (ByteString)
import Data.Text (Text)
import GHC.Generics (Generic)
import Network.HTTP.Types (QueryItem)
import qualified Network.URI as Network
import OpenID.Connect.JSON
import OpenID.Connect.Scope
data ClientSecret
= AssignedSecretText Text
| AssignedAssertionText Text
| AssertionPrivateKey JWK
type ClientID = Text
type ClientRedirectURI = Network.URI
data Credentials = Credentials
{ Credentials -> ClientID
assignedClientId :: ClientID
, Credentials -> ClientSecret
clientSecret :: ClientSecret
, Credentials -> ClientRedirectURI
clientRedirectUri :: ClientRedirectURI
}
data AuthenticationRequest = AuthenticationRequest
{ AuthenticationRequest -> ClientRedirectURI
authRequestRedirectURI :: ClientRedirectURI
, AuthenticationRequest -> ClientID
authRequestClientId :: Text
, AuthenticationRequest -> Scope
authRequestScope :: Scope
, AuthenticationRequest -> ByteString
authRequestResponseType :: ByteString
, AuthenticationRequest -> Maybe ByteString
authRequestDisplay :: Maybe ByteString
, AuthenticationRequest -> Maybe ByteString
authRequestPrompt :: Maybe ByteString
, AuthenticationRequest -> Maybe Int
authRequestMaxAge :: Maybe Int
, AuthenticationRequest -> Maybe Words
authRequestUiLocales :: Maybe Words
, AuthenticationRequest -> Maybe ByteString
authRequestIdTokenHint :: Maybe ByteString
, AuthenticationRequest -> Maybe ClientID
authRequestLoginHint :: Maybe Text
, AuthenticationRequest -> Maybe Words
authRequestAcrValues :: Maybe Words
, AuthenticationRequest -> [QueryItem]
authRequestOtherParams :: [QueryItem]
}
data ClientAuthentication
= ClientSecretBasic
| ClientSecretPost
| ClientSecretJwt
| PrivateKeyJwt
| None
deriving stock ((forall x. ClientAuthentication -> Rep ClientAuthentication x)
-> (forall x. Rep ClientAuthentication x -> ClientAuthentication)
-> Generic ClientAuthentication
forall x. Rep ClientAuthentication x -> ClientAuthentication
forall x. ClientAuthentication -> Rep ClientAuthentication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClientAuthentication x -> ClientAuthentication
$cfrom :: forall x. ClientAuthentication -> Rep ClientAuthentication x
Generic, ClientAuthentication -> ClientAuthentication -> Bool
(ClientAuthentication -> ClientAuthentication -> Bool)
-> (ClientAuthentication -> ClientAuthentication -> Bool)
-> Eq ClientAuthentication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientAuthentication -> ClientAuthentication -> Bool
$c/= :: ClientAuthentication -> ClientAuthentication -> Bool
== :: ClientAuthentication -> ClientAuthentication -> Bool
$c== :: ClientAuthentication -> ClientAuthentication -> Bool
Eq, Int -> ClientAuthentication -> ShowS
[ClientAuthentication] -> ShowS
ClientAuthentication -> String
(Int -> ClientAuthentication -> ShowS)
-> (ClientAuthentication -> String)
-> ([ClientAuthentication] -> ShowS)
-> Show ClientAuthentication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClientAuthentication] -> ShowS
$cshowList :: [ClientAuthentication] -> ShowS
show :: ClientAuthentication -> String
$cshow :: ClientAuthentication -> String
showsPrec :: Int -> ClientAuthentication -> ShowS
$cshowsPrec :: Int -> ClientAuthentication -> ShowS
Show)
deriving ([ClientAuthentication] -> Encoding
[ClientAuthentication] -> Value
ClientAuthentication -> Encoding
ClientAuthentication -> Value
(ClientAuthentication -> Value)
-> (ClientAuthentication -> Encoding)
-> ([ClientAuthentication] -> Value)
-> ([ClientAuthentication] -> Encoding)
-> ToJSON ClientAuthentication
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ClientAuthentication] -> Encoding
$ctoEncodingList :: [ClientAuthentication] -> Encoding
toJSONList :: [ClientAuthentication] -> Value
$ctoJSONList :: [ClientAuthentication] -> Value
toEncoding :: ClientAuthentication -> Encoding
$ctoEncoding :: ClientAuthentication -> Encoding
toJSON :: ClientAuthentication -> Value
$ctoJSON :: ClientAuthentication -> Value
ToJSON, Value -> Parser [ClientAuthentication]
Value -> Parser ClientAuthentication
(Value -> Parser ClientAuthentication)
-> (Value -> Parser [ClientAuthentication])
-> FromJSON ClientAuthentication
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ClientAuthentication]
$cparseJSONList :: Value -> Parser [ClientAuthentication]
parseJSON :: Value -> Parser ClientAuthentication
$cparseJSON :: Value -> Parser ClientAuthentication
FromJSON) via GenericJSON ClientAuthentication