Copyright | This file is part of the package openid-connect. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at: https://code.devalot.com/open/openid-connect No part of this package including this file may be copied modified propagated or distributed except according to the terms contained in the LICENSE file. |
---|---|
License | BSD-2-Clause |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
OpenID Connect Dynamic Client Registration 1.0.
Synopsis
- registerClient :: (Monad m, ToJSON a, FromJSON a) => HTTPS m -> Discovery -> ClientMetadata a -> m (Either RegistrationError (ClientMetadataResponse a))
- data RegistrationError
- type HTTPS m = Request -> m (Response ByteString)
- data ErrorResponse = ErrorResponse {}
- data Registration = Registration {
- redirectUris :: NonEmpty URI
- responseTypes :: Maybe (NonEmpty Text)
- grantTypes :: Maybe (NonEmpty Text)
- applicationType :: Maybe Text
- contacts :: Maybe (NonEmpty Text)
- clientName :: Maybe Text
- logoUri :: Maybe URI
- clientUri :: Maybe URI
- policyUri :: Maybe URI
- tosUri :: Maybe URI
- jwksUri :: Maybe URI
- jwks :: Maybe JWKSet
- sectorIdentifierUri :: Maybe URI
- subjectType :: Maybe Text
- idTokenSignedResponseAlg :: Maybe Alg
- idTokenEncryptedResponseAlg :: Maybe Alg
- idTokenEncryptedResponseEnc :: Maybe Alg
- userinfoSignedResponseAlg :: Maybe Alg
- userinfoEncryptedResponseAlg :: Maybe Alg
- userinfoEncryptedResponseEnc :: Maybe Alg
- requestObjectSigningAlg :: Maybe Alg
- requestObjectEncryptionAlg :: Maybe Alg
- requestObjectEncryptionEnc :: Maybe Alg
- tokenEndpointAuthMethod :: ClientAuthentication
- tokenEndpointAuthSigningAlg :: Maybe Alg
- defaultMaxAge :: Maybe Int
- requireAuthTime :: Maybe Bool
- defaultAcrValues :: Maybe (NonEmpty Text)
- initiateLoginUri :: Maybe URI
- requestUris :: Maybe (NonEmpty URI)
- defaultRegistration :: URI -> Registration
- type ClientMetadata a = Registration :*: a
- data BasicRegistration = BasicRegistration
- clientMetadata :: Registration -> a -> ClientMetadata a
- data RegistrationResponse = RegistrationResponse {}
- type ClientMetadataResponse a = (Registration :*: RegistrationResponse) :*: a
- clientSecretsFromResponse :: ClientMetadataResponse a -> RegistrationResponse
- additionalMetadataFromResponse :: ClientMetadataResponse a -> a
- registrationFromResponse :: ClientMetadataResponse a -> Registration
- data a :*: b
- newtype URI = URI {}
Registration
registerClient :: (Monad m, ToJSON a, FromJSON a) => HTTPS m -> Discovery -> ClientMetadata a -> m (Either RegistrationError (ClientMetadataResponse a)) Source #
Register a client with the provider described by the Discovery
document.
Example:
let reg =defaultRegistration
yourClientRedirURI metadata =clientMetadata
regBasicRegistration
in registerClient http discoveryDoc metadata
Errors that can occur
data RegistrationError Source #
Errors that can occur during dynamic client registration.
Instances
Exception RegistrationError Source # | |
Show RegistrationError Source # | |
Defined in OpenID.Connect.Client.DynamicRegistration showsPrec :: Int -> RegistrationError -> ShowS # show :: RegistrationError -> String # showList :: [RegistrationError] -> ShowS # |
Re-exports
type HTTPS m = Request -> m (Response ByteString) Source #
A function that can make HTTPS requests.
Make sure you are using a Manager
value from the
http-client-tls
package. It's imperative that the requests
flowing through this function are encrypted.
All requests are set to throw an exception if the response status
code is not in the 2xx range. Therefore, functions that take this
HTTPS
type should be called in an exception-safe way and any
exception should be treated as an authentication failure.
Since: 0.1.0.0
data ErrorResponse Source #
A provider response that indicates an error as described in OAuth 2.0 Bearer Token Usage (RFC 6750).
Since: 0.1.0.0
Instances
FromJSON ErrorResponse Source # | |
Defined in OpenID.Connect.JSON parseJSON :: Value -> Parser ErrorResponse # parseJSONList :: Value -> Parser [ErrorResponse] # | |
ToJSON ErrorResponse Source # | |
Defined in OpenID.Connect.JSON toJSON :: ErrorResponse -> Value # toEncoding :: ErrorResponse -> Encoding # toJSONList :: [ErrorResponse] -> Value # toEncodingList :: [ErrorResponse] -> Encoding # | |
Show ErrorResponse Source # | |
Defined in OpenID.Connect.JSON showsPrec :: Int -> ErrorResponse -> ShowS # show :: ErrorResponse -> String # showList :: [ErrorResponse] -> ShowS # |
data Registration Source #
Client registration metadata.
OpenID Connect Dynamic Client Registration 1.0 §2.
Use the defaultRegistration
function to easily create a value of
this type.
Registration | |
|
Instances
defaultRegistration :: URI -> Registration Source #
The default Registration
value.
type ClientMetadata a = Registration :*: a Source #
Registration fields with any additional fields that are
necessary. If no additional fields are needed, use
BasicRegistration
to fill the type variable.
data BasicRegistration Source #
Tag the ClientMetadata
and ClientMetadataResponse
types as
having no additional metadata parameters.
Instances
FromJSON BasicRegistration Source # | |
Defined in OpenID.Connect.Registration parseJSON :: Value -> Parser BasicRegistration # parseJSONList :: Value -> Parser [BasicRegistration] # | |
ToJSON BasicRegistration Source # | |
Defined in OpenID.Connect.Registration toJSON :: BasicRegistration -> Value # toEncoding :: BasicRegistration -> Encoding # toJSONList :: [BasicRegistration] -> Value # toEncodingList :: [BasicRegistration] -> Encoding # |
clientMetadata :: Registration -> a -> ClientMetadata a Source #
Create a complete ClientMetadata
record from an existing
Registration
value and any additional client metadata parameters
that are needed.
If you don't need to specify additional client metadata parameters
you can use BasicRegistration
as the a
type. In that case, the
type signature would be:
clientMetadata :: Registration -> BasicRegistration -> ClientMetadata BasicRegistration
data RegistrationResponse Source #
Client Registration Response.
OpenID Connect Dynamic Client Registration 1.0 §3.2.
RegistrationResponse | |
|
Instances
type ClientMetadataResponse a = (Registration :*: RegistrationResponse) :*: a Source #
Like ClientMetadata
but includes the registration response.
clientSecretsFromResponse :: ClientMetadataResponse a -> RegistrationResponse Source #
Extract the client details from a registration response.
additionalMetadataFromResponse :: ClientMetadataResponse a -> a Source #
Extract the additional metadata fields from a full registration response.
registrationFromResponse :: ClientMetadataResponse a -> Registration Source #
Extract the registration value from a full registration response.
Join two types together so they work with the same JSON document.