hoauth2-2.14.3: Haskell OAuth2 authentication client

Safe Haskell | None
Language | Haskell2010

Network.OAuth2.Experiment.Flows.TokenRequest

Synopsis

- class HasTokenRequestClientAuthenticationMethod a where
  - getClientAuthenticationMethod :: a -> ClientAuthenticationMethod
- data NoNeedExchangeToken = NoNeedExchangeToken
- class (HasOAuth2Key a, HasTokenRequestClientAuthenticationMethod a) => HasTokenRequest a where
  - data TokenRequest a
  - type ExchangeTokenInfo a
  - mkTokenRequestParam :: a -> ExchangeTokenInfo a -> TokenRequest a
- conduitTokenRequest :: forall {k} a (m :: Type -> Type) (i :: k). (HasTokenRequest a, ToQueryParam (TokenRequest a), MonadIO m) => IdpApplication i a -> Manager -> ExchangeTokenInfo a -> ExceptT TokenResponseError m OAuth2Token
- conduitPkceTokenRequest :: forall {k} a (m :: Type -> Type) (i :: k). (HasTokenRequest a, ToQueryParam (TokenRequest a), MonadIO m) => IdpApplication i a -> Manager -> (ExchangeTokenInfo a, CodeVerifier) -> ExceptT TokenResponseError m OAuth2Token
- conduitTokenRequestInternal :: forall {k} a (m :: Type -> Type) (i :: k). (HasTokenRequest a, ToQueryParam (TokenRequest a), MonadIO m) => IdpApplication i a -> Manager -> (ExchangeTokenInfo a, Maybe CodeVerifier) -> ExceptT TokenResponseError m OAuth2Token
- doTokenRequestInternal :: forall (m :: Type -> Type) a. (MonadIO m, FromJSON a) => ClientAuthenticationMethod -> Manager -> OAuth2 -> URI -> PostBody -> ExceptT TokenResponseError m a

# Documentation

class HasTokenRequestClientAuthenticationMethod a where Source #

Methods

getClientAuthenticationMethod :: a -> ClientAuthenticationMethod Source #

#### Instances

Instances details

HasTokenRequestClientAuthenticationMethod AuthorizationCodeApplication Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.AuthorizationCode Methods getClientAuthenticationMethod :: AuthorizationCodeApplication -> ClientAuthenticationMethod Source #
HasTokenRequestClientAuthenticationMethod ClientCredentialsApplication Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.ClientCredentials Methods getClientAuthenticationMethod :: ClientCredentialsApplication -> ClientAuthenticationMethod Source #
HasTokenRequestClientAuthenticationMethod DeviceAuthorizationApplication Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.DeviceAuthorization Methods getClientAuthenticationMethod :: DeviceAuthorizationApplication -> ClientAuthenticationMethod Source #
HasTokenRequestClientAuthenticationMethod JwtBearerApplication Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.JwtBearer Methods getClientAuthenticationMethod :: JwtBearerApplication -> ClientAuthenticationMethod Source #
HasTokenRequestClientAuthenticationMethod ResourceOwnerPasswordApplication Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.ResourceOwnerPassword Methods getClientAuthenticationMethod :: ResourceOwnerPasswordApplication -> ClientAuthenticationMethod Source #

data NoNeedExchangeToken Source #

Only Authorization Code Grant involves a Exchange Token (Authorization Code). ResourceOwnerPassword and Client Credentials make token request directly.

Constructors

NoNeedExchangeToken |

class (HasOAuth2Key a, HasTokenRequestClientAuthenticationMethod a) => HasTokenRequest a where Source #

Associated Types

data TokenRequest a Source #

type ExchangeTokenInfo a Source #

Methods

mkTokenRequestParam :: a -> ExchangeTokenInfo a -> TokenRequest a Source #

Only 'AuthorizationCode flow (but not resource owner password nor client credentials) will use `ExchangeToken` in the token request create type family to be explicit on it. with 'type instance WithExchangeToken a b = b' implies no exchange token v.s. 'type instance WithExchangeToken a b = ExchangeToken -> b' implies needing an exchange token type WithExchangeToken a b

#### Instances

Instances details

HasTokenRequest AuthorizationCodeApplication Source # | https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3

Instance details

Defined in Network.OAuth2.Experiment.Grants.AuthorizationCode

Associated Types

data TokenRequest AuthorizationCodeApplication |

Instance details

Defined in Network.OAuth2.Experiment.Grants.AuthorizationCode

data TokenRequest AuthorizationCodeApplication = AuthorizationCodeTokenRequest {

- trCode :: ExchangeToken
- trGrantType :: GrantTypeValue
- trRedirectUri :: RedirectUri
- trClientId :: Maybe ClientId
- trClientSecret :: Maybe ClientSecret

}

type ExchangeTokenInfo AuthorizationCodeApplication |
Instance details Defined in Network.OAuth2.Experiment.Grants.AuthorizationCode type ExchangeTokenInfo AuthorizationCodeApplication = ExchangeToken

Methods

mkTokenRequestParam :: AuthorizationCodeApplication -> ExchangeTokenInfo AuthorizationCodeApplication -> TokenRequest AuthorizationCodeApplication Source #

HasTokenRequest ClientCredentialsApplication Source # | https://www.rfc-editor.org/rfc/rfc6749#section-4.4.2

Instance details

Defined in Network.OAuth2.Experiment.Grants.ClientCredentials

Associated Types

data TokenRequest ClientCredentialsApplication |

Instance details

Defined in Network.OAuth2.Experiment.Grants.ClientCredentials

data TokenRequest ClientCredentialsApplication = ClientCredentialsTokenRequest {

- trScope :: Set Scope
- trGrantType :: GrantTypeValue
- trClientSecret :: ClientSecret
- trClientId :: ClientId
- trExtraParams :: Map Text Text
- trClientAuthenticationMethod :: ClientAuthenticationMethod

}

type ExchangeTokenInfo ClientCredentialsApplication |
Instance details Defined in Network.OAuth2.Experiment.Grants.ClientCredentials type ExchangeTokenInfo ClientCredentialsApplication = NoNeedExchangeToken

Methods

mkTokenRequestParam :: ClientCredentialsApplication -> ExchangeTokenInfo ClientCredentialsApplication -> TokenRequest ClientCredentialsApplication Source #

HasTokenRequest DeviceAuthorizationApplication Source # | https://www.rfc-editor.org/rfc/rfc8628#section-3.4

Instance details

Defined in Network.OAuth2.Experiment.Grants.DeviceAuthorization

Associated Types

data TokenRequest DeviceAuthorizationApplication |

Instance details

Defined in Network.OAuth2.Experiment.Grants.DeviceAuthorization

data TokenRequest DeviceAuthorizationApplication = AuthorizationCodeTokenRequest {

- trCode :: DeviceCode
- trGrantType :: GrantTypeValue
- trClientId :: Maybe ClientId

}

type ExchangeTokenInfo DeviceAuthorizationApplication |
Instance details Defined in Network.OAuth2.Experiment.Grants.DeviceAuthorization type ExchangeTokenInfo DeviceAuthorizationApplication = DeviceCode

Methods

mkTokenRequestParam :: DeviceAuthorizationApplication -> ExchangeTokenInfo DeviceAuthorizationApplication -> TokenRequest DeviceAuthorizationApplication Source #

HasTokenRequest JwtBearerApplication Source # |

Instance details

Defined in Network.OAuth2.Experiment.Grants.JwtBearer

Associated Types

data TokenRequest JwtBearerApplication |

Instance details

Defined in Network.OAuth2.Experiment.Grants.JwtBearer

data TokenRequest JwtBearerApplication = JwtBearerTokenRequest {

- trGrantType :: GrantTypeValue
- trAssertion :: ByteString

}

type ExchangeTokenInfo JwtBearerApplication |
Instance details Defined in Network.OAuth2.Experiment.Grants.JwtBearer type ExchangeTokenInfo JwtBearerApplication = NoNeedExchangeToken

Methods

mkTokenRequestParam :: JwtBearerApplication -> ExchangeTokenInfo JwtBearerApplication -> TokenRequest JwtBearerApplication Source #

HasTokenRequest ResourceOwnerPasswordApplication Source # | https://www.rfc-editor.org/rfc/rfc6749#section-4.3.2

Instance details

Defined in Network.OAuth2.Experiment.Grants.ResourceOwnerPassword

Associated Types

data TokenRequest ResourceOwnerPasswordApplication |

Instance details

Defined in Network.OAuth2.Experiment.Grants.ResourceOwnerPassword

data TokenRequest ResourceOwnerPasswordApplication = PasswordTokenRequest {

- trScope :: Set Scope
- trUsername :: Username
- trPassword :: Password
- trGrantType :: GrantTypeValue
- trExtraParams :: Map Text Text

}

type ExchangeTokenInfo ResourceOwnerPasswordApplication |
Instance details Defined in Network.OAuth2.Experiment.Grants.ResourceOwnerPassword type ExchangeTokenInfo ResourceOwnerPasswordApplication = NoNeedExchangeToken

Methods

mkTokenRequestParam :: ResourceOwnerPasswordApplication -> ExchangeTokenInfo ResourceOwnerPasswordApplication -> TokenRequest ResourceOwnerPasswordApplication Source #

conduitTokenRequest :: forall {k} a (m :: Type -> Type) (i :: k). (HasTokenRequest a, ToQueryParam (TokenRequest a), MonadIO m) => IdpApplication i a -> Manager -> ExchangeTokenInfo a -> ExceptT TokenResponseError m OAuth2Token Source #

https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3

conduitPkceTokenRequest :: forall {k} a (m :: Type -> Type) (i :: k). (HasTokenRequest a, ToQueryParam (TokenRequest a), MonadIO m) => IdpApplication i a -> Manager -> (ExchangeTokenInfo a, CodeVerifier) -> ExceptT TokenResponseError m OAuth2Token Source #

https://datatracker.ietf.org/doc/html/rfc7636#section-4.5

conduitTokenRequestInternal :: forall {k} a (m :: Type -> Type) (i :: k). (HasTokenRequest a, ToQueryParam (TokenRequest a), MonadIO m) => IdpApplication i a -> Manager -> (ExchangeTokenInfo a, Maybe CodeVerifier) -> ExceptT TokenResponseError m OAuth2Token Source #

doTokenRequestInternal Source #

Arguments

:: forall (m :: Type -> Type) a. (MonadIO m, FromJSON a) |
=> ClientAuthenticationMethod |
-> Manager | HTTP connection manager.
-> OAuth2 | OAuth options
-> URI | URL
-> PostBody | Request body.
-> ExceptT TokenResponseError m a | Response as ByteString