hoauth2-2.14.3: Haskell OAuth2 authentication client

Safe Haskell | None
Language | Haskell2010

Network.OAuth2.Experiment.Types

Contents

- Idp App
- Scope
- Grant Type value
- Credentials
- Query parameters

Synopsis

- data Idp (i :: k) = Idp {
  - idpUserInfoEndpoint :: URI
  - idpAuthorizeEndpoint :: URI
  - idpTokenEndpoint :: URI
  - idpDeviceAuthorizationEndpoint :: Maybe URI
  }
- data IdpApplication (i :: k) a = IdpApplication {
  - idp :: Idp i
  - application :: a
  }
- newtype Scope = Scope {
  - unScope :: Text
  }
- data GrantTypeValue
  - = GTAuthorizationCode
  - | GTPassword
  - | GTClientCredentials
  - | GTRefreshToken
  - | GTJwtBearer
  - | GTDeviceCode
- data ResponseType = Code
- newtype ClientId = ClientId {
  - unClientId :: Text
  }
- newtype ClientSecret = ClientSecret {
  - unClientSecret :: Text
  }
- toOAuth2Key :: ClientId -> ClientSecret -> OAuth2
- newtype RedirectUri = RedirectUri {
  - unRedirectUri :: URI
  }
- newtype AuthorizeState = AuthorizeState {
  - unAuthorizeState :: Text
  }
- newtype Username = Username {
  - unUsername :: Text
  }
- newtype Password = Password {
  - unPassword :: Text
  }
- class ToQueryParam a where
  - toQueryParam :: a -> Map Text Text
- class HasOAuth2Key a where
  - mkOAuth2Key :: a -> OAuth2

# Idp App

data Idp (i :: k) Source #

`Idp i` consists various endpoints endpoints.

The `i` is actually phantom type for information only (Idp name) at this moment. And it is PolyKinds.

Hence whenever `Idp i` or `IdpApplication i a` is used as function parameter, PolyKinds need to be enabled.

Constructors

Idp |

Fields

- idpUserInfoEndpoint :: URI

  Userinfo Endpoint

- idpAuthorizeEndpoint :: URI

  Authorization Endpoint

- idpTokenEndpoint :: URI

  Token Endpoint

- idpDeviceAuthorizationEndpoint :: Maybe URI

  Apparently not all IdP support device code flow

data IdpApplication (i :: k) a Source #

An OAuth2 Application "a" of IdP "i". "a" can be one of following type:

- `AuthorizationCodeApplication`
- `DeviceAuthorizationApplication`
- `ClientCredentialsApplication`
- `ResourceOwnerPasswordApplication`
- `JwtBearerApplication`

Constructors

IdpApplication |

Fields

- idp :: Idp i
- application :: a

# Scope

newtype Scope Source #

Constructors

Scope |

Fields

- unScope :: Text

#### Instances

Instances details

IsString Scope Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods fromString :: String -> Scope Source #
Show Scope Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods showsPrec :: Int -> Scope -> ShowS Source # show :: Scope -> String Source # showList :: [Scope] -> ShowS Source #
Eq Scope Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: Scope -> Scope -> Bool Source # (/=) :: Scope -> Scope -> Bool Source #
Ord Scope Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods compare :: Scope -> Scope -> Ordering Source # (<) :: Scope -> Scope -> Bool Source # (<=) :: Scope -> Scope -> Bool Source # (>) :: Scope -> Scope -> Bool Source # (>=) :: Scope -> Scope -> Bool Source # max :: Scope -> Scope -> Scope Source # min :: Scope -> Scope -> Scope Source #
ToQueryParam (Set Scope) Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Set Scope -> Map Text Text Source #

# Grant Type value

data GrantTypeValue Source #

Grant type query parameter has association with different GrantType flows but not completely strict.

e.g. Both AuthorizationCode and ResourceOwnerPassword flow could support refresh token flow.

Constructors

GTAuthorizationCode |
GTPassword |
GTClientCredentials |
GTRefreshToken |
GTJwtBearer |
GTDeviceCode |

#### Instances

Instances details

Show GrantTypeValue Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods showsPrec :: Int -> GrantTypeValue -> ShowS Source # show :: GrantTypeValue -> String Source # showList :: [GrantTypeValue] -> ShowS Source #
Eq GrantTypeValue Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: GrantTypeValue -> GrantTypeValue -> Bool Source # (/=) :: GrantTypeValue -> GrantTypeValue -> Bool Source #
ToQueryParam GrantTypeValue Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: GrantTypeValue -> Map Text Text Source #

data ResponseType Source #

Constructors

Code |

#### Instances

Instances details

ToQueryParam ResponseType Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ResponseType -> Map Text Text Source #

# Credentials

newtype ClientId Source #

Constructors

ClientId |

Fields

- unClientId :: Text

#### Instances

Instances details

IsString ClientId Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods fromString :: String -> ClientId Source #
Show ClientId Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods showsPrec :: Int -> ClientId -> ShowS Source # show :: ClientId -> String Source # showList :: [ClientId] -> ShowS Source #
Eq ClientId Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: ClientId -> ClientId -> Bool Source # (/=) :: ClientId -> ClientId -> Bool Source #
ToQueryParam ClientId Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ClientId -> Map Text Text Source #

newtype ClientSecret Source #

Can be either "Client Secret" or JWT base on client authentication method

Constructors

ClientSecret |

Fields

- unClientSecret :: Text

#### Instances

Instances details

IsString ClientSecret Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods fromString :: String -> ClientSecret Source #
Eq ClientSecret Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: ClientSecret -> ClientSecret -> Bool Source # (/=) :: ClientSecret -> ClientSecret -> Bool Source #
ToQueryParam ClientSecret Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ClientSecret -> Map Text Text Source #

toOAuth2Key :: ClientId -> ClientSecret -> OAuth2 Source #

In order to reuse some methods from legacy Network.OAuth.OAuth2. Will be removed when Experiment module becomes default.

newtype RedirectUri Source #

Constructors

RedirectUri |

Fields

- unRedirectUri :: URI

#### Instances

Instances details

Eq RedirectUri Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: RedirectUri -> RedirectUri -> Bool Source # (/=) :: RedirectUri -> RedirectUri -> Bool Source #
ToQueryParam RedirectUri Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: RedirectUri -> Map Text Text Source #

newtype AuthorizeState Source #

Constructors

AuthorizeState |

Fields

- unAuthorizeState :: Text

#### Instances

Instances details

IsString AuthorizeState Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods fromString :: String -> AuthorizeState Source #
Eq AuthorizeState Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: AuthorizeState -> AuthorizeState -> Bool Source # (/=) :: AuthorizeState -> AuthorizeState -> Bool Source #
ToQueryParam AuthorizeState Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: AuthorizeState -> Map Text Text Source #

newtype Username Source #

Constructors

Username |

Fields

- unUsername :: Text

#### Instances

Instances details

IsString Username Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods fromString :: String -> Username Source #
Eq Username Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: Username -> Username -> Bool Source # (/=) :: Username -> Username -> Bool Source #
ToQueryParam Username Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Username -> Map Text Text Source #

newtype Password Source #

Constructors

Password |

Fields

- unPassword :: Text

#### Instances

Instances details

IsString Password Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods fromString :: String -> Password Source #
Eq Password Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods (==) :: Password -> Password -> Bool Source # (/=) :: Password -> Password -> Bool Source #
ToQueryParam Password Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Password -> Map Text Text Source #

# Query parameters

class ToQueryParam a where Source #

Methods

toQueryParam :: a -> Map Text Text Source #

#### Instances

Instances details

ToQueryParam ExchangeToken Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ExchangeToken -> Map Text Text Source #
ToQueryParam RefreshToken Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: RefreshToken -> Map Text Text Source #
ToQueryParam AuthorizationRequestParam Source # |
Instance details Defined in Network.OAuth2.Experiment.Flows.AuthorizationRequest Methods toQueryParam :: AuthorizationRequestParam -> Map Text Text Source #
ToQueryParam DeviceAuthorizationRequestParam Source # |
Instance details Defined in Network.OAuth2.Experiment.Flows.DeviceAuthorizationRequest Methods toQueryParam :: DeviceAuthorizationRequestParam -> Map Text Text Source #
ToQueryParam DeviceCode Source # |
Instance details Defined in Network.OAuth2.Experiment.Flows.DeviceAuthorizationRequest Methods toQueryParam :: DeviceCode -> Map Text Text Source #
ToQueryParam RefreshTokenRequest Source # |
Instance details Defined in Network.OAuth2.Experiment.Flows.RefreshTokenRequest Methods toQueryParam :: RefreshTokenRequest -> Map Text Text Source #
ToQueryParam CodeChallenge Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: CodeChallenge -> Map Text Text Source #
ToQueryParam CodeChallengeMethod Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: CodeChallengeMethod -> Map Text Text Source #
ToQueryParam CodeVerifier Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: CodeVerifier -> Map Text Text Source #
ToQueryParam AuthorizeState Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: AuthorizeState -> Map Text Text Source #
ToQueryParam ClientId Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ClientId -> Map Text Text Source #
ToQueryParam ClientSecret Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ClientSecret -> Map Text Text Source #
ToQueryParam GrantTypeValue Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: GrantTypeValue -> Map Text Text Source #
ToQueryParam Password Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Password -> Map Text Text Source #
ToQueryParam RedirectUri Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: RedirectUri -> Map Text Text Source #
ToQueryParam ResponseType Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ResponseType -> Map Text Text Source #
ToQueryParam Username Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Username -> Map Text Text Source #
ToQueryParam (Set Scope) Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Set Scope -> Map Text Text Source #
ToQueryParam (TokenRequest AuthorizationCodeApplication) Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.AuthorizationCode Methods toQueryParam :: TokenRequest AuthorizationCodeApplication -> Map Text Text Source #
ToQueryParam (TokenRequest ClientCredentialsApplication) Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.ClientCredentials Methods toQueryParam :: TokenRequest ClientCredentialsApplication -> Map Text Text Source #
ToQueryParam (TokenRequest DeviceAuthorizationApplication) Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.DeviceAuthorization Methods toQueryParam :: TokenRequest DeviceAuthorizationApplication -> Map Text Text Source #
ToQueryParam (TokenRequest JwtBearerApplication) Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.JwtBearer Methods toQueryParam :: TokenRequest JwtBearerApplication -> Map Text Text Source #
ToQueryParam (TokenRequest ResourceOwnerPasswordApplication) Source # |
Instance details Defined in Network.OAuth2.Experiment.Grants.ResourceOwnerPassword Methods toQueryParam :: TokenRequest ResourceOwnerPasswordApplication -> Map Text Text Source #
ToQueryParam a => ToQueryParam (Maybe a) Source # |
Instance details Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: Maybe a -> Map Text Text Source #

class HasOAuth2Key a where Source #

Methods

mkOAuth2Key :: a -> OAuth2 Source #

#### Instances

Instances details

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