Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Network.OAuth.OAuth2.Internal
Contents
Synopsis
- data OAuth2 = OAuth2 {
- oauth2ClientId :: Text
- oauth2ClientSecret :: Text
- oauth2AuthorizeEndpoint :: URIRef Absolute
- oauth2TokenEndpoint :: URIRef Absolute
- oauth2RedirectUri :: URIRef Absolute
- newtype AccessToken = AccessToken {
- atoken :: Text
- newtype RefreshToken = RefreshToken {
- rtoken :: Text
- newtype IdToken = IdToken {
- idtoken :: Text
- newtype ExchangeToken = ExchangeToken {
- extoken :: Text
- data OAuth2Token = OAuth2Token {
- accessToken :: AccessToken
- refreshToken :: Maybe RefreshToken
- expiresIn :: Maybe Int
- tokenType :: Maybe Text
- idToken :: Maybe IdToken
- data OAuth2Error a = OAuth2Error {
- error :: Either Text a
- errorDescription :: Maybe Text
- errorUri :: Maybe (URIRef Absolute)
- parseOAuth2Error :: FromJSON err => ByteString -> OAuth2Error err
- mkDecodeOAuth2Error :: ByteString -> String -> OAuth2Error err
- data ClientAuthenticationMethod
- type PostBody = [(ByteString, ByteString)]
- type QueryParams = [(ByteString, ByteString)]
- defaultRequestHeaders :: [(HeaderName, ByteString)]
- appendQueryParams :: [(ByteString, ByteString)] -> URIRef a -> URIRef a
- uriToRequest :: MonadThrow m => URI -> m Request
- requestToUri :: Request -> URI
- hostLens :: Lens' Request ByteString
- portLens :: Lens' Request Int
Data Types
Query Parameter Representation
Constructors
OAuth2 | |
Fields
|
newtype AccessToken Source #
Constructors
AccessToken | |
Fields
|
Instances
FromJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
ToJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: AccessToken -> Value toEncoding :: AccessToken -> Encoding toJSONList :: [AccessToken] -> Value toEncodingList :: [AccessToken] -> Encoding | |
Show AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods showsPrec :: Int -> AccessToken -> ShowS show :: AccessToken -> String showList :: [AccessToken] -> ShowS | |
Binary AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
Eq AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal |
newtype RefreshToken Source #
Constructors
RefreshToken | |
Fields
|
Instances
FromJSON RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
ToJSON RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: RefreshToken -> Value toEncoding :: RefreshToken -> Encoding toJSONList :: [RefreshToken] -> Value toEncodingList :: [RefreshToken] -> Encoding | |
Show RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods showsPrec :: Int -> RefreshToken -> ShowS show :: RefreshToken -> String showList :: [RefreshToken] -> ShowS | |
Binary RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
Eq RefreshToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
ToQueryParam RefreshToken Source # | |
Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: RefreshToken -> Map Text Text Source # |
Instances
FromJSON IdToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
ToJSON IdToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toEncoding :: IdToken -> Encoding toJSONList :: [IdToken] -> Value toEncodingList :: [IdToken] -> Encoding | |
Show IdToken Source # | |
Binary IdToken Source # | |
Eq IdToken Source # | |
newtype ExchangeToken Source #
Authorization Code
Constructors
ExchangeToken | |
Fields
|
Instances
FromJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
ToJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: ExchangeToken -> Value toEncoding :: ExchangeToken -> Encoding toJSONList :: [ExchangeToken] -> Value toEncodingList :: [ExchangeToken] -> Encoding | |
Show ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods showsPrec :: Int -> ExchangeToken -> ShowS show :: ExchangeToken -> String showList :: [ExchangeToken] -> ShowS | |
ToQueryParam ExchangeToken Source # | |
Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ExchangeToken -> Map Text Text Source # |
data OAuth2Token Source #
Constructors
OAuth2Token | |
Fields
|
Instances
FromJSON OAuth2Token Source # | Parse JSON data into |
Defined in Network.OAuth.OAuth2.Internal | |
ToJSON OAuth2Token Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: OAuth2Token -> Value toEncoding :: OAuth2Token -> Encoding toJSONList :: [OAuth2Token] -> Value toEncodingList :: [OAuth2Token] -> Encoding | |
Generic OAuth2Token Source # | |
Defined in Network.OAuth.OAuth2.Internal Associated Types type Rep OAuth2Token :: Type -> Type | |
Show OAuth2Token Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods showsPrec :: Int -> OAuth2Token -> ShowS show :: OAuth2Token -> String showList :: [OAuth2Token] -> ShowS | |
Binary OAuth2Token Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
Eq OAuth2Token Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
type Rep OAuth2Token Source # | |
Defined in Network.OAuth.OAuth2.Internal type Rep OAuth2Token = D1 ('MetaData "OAuth2Token" "Network.OAuth.OAuth2.Internal" "hoauth2-2.6.0-3FEv8fwd5ChB6MWJsO0DWt" 'False) (C1 ('MetaCons "OAuth2Token" 'PrefixI 'True) ((S1 ('MetaSel ('Just "accessToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AccessToken) :*: S1 ('MetaSel ('Just "refreshToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe RefreshToken))) :*: (S1 ('MetaSel ('Just "expiresIn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: (S1 ('MetaSel ('Just "tokenType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "idToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe IdToken)))))) |
data OAuth2Error a Source #
Constructors
OAuth2Error | |
Fields
|
Instances
FromJSON err => FromJSON (OAuth2Error err) Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods parseJSON :: Value -> Parser (OAuth2Error err) parseJSONList :: Value -> Parser [OAuth2Error err] | |
ToJSON err => ToJSON (OAuth2Error err) Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: OAuth2Error err -> Value toEncoding :: OAuth2Error err -> Encoding toJSONList :: [OAuth2Error err] -> Value toEncodingList :: [OAuth2Error err] -> Encoding | |
Generic (OAuth2Error a) Source # | |
Defined in Network.OAuth.OAuth2.Internal Associated Types type Rep (OAuth2Error a) :: Type -> Type | |
Show a => Show (OAuth2Error a) Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods showsPrec :: Int -> OAuth2Error a -> ShowS show :: OAuth2Error a -> String showList :: [OAuth2Error a] -> ShowS | |
Eq a => Eq (OAuth2Error a) Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
type Rep (OAuth2Error a) Source # | |
Defined in Network.OAuth.OAuth2.Internal type Rep (OAuth2Error a) = D1 ('MetaData "OAuth2Error" "Network.OAuth.OAuth2.Internal" "hoauth2-2.6.0-3FEv8fwd5ChB6MWJsO0DWt" 'False) (C1 ('MetaCons "OAuth2Error" 'PrefixI 'True) (S1 ('MetaSel ('Just "error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either Text a)) :*: (S1 ('MetaSel ('Just "errorDescription") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "errorUri") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (URIRef Absolute)))))) |
parseOAuth2Error :: FromJSON err => ByteString -> OAuth2Error err Source #
mkDecodeOAuth2Error :: ByteString -> String -> OAuth2Error err Source #
data ClientAuthenticationMethod Source #
https://www.rfc-editor.org/rfc/rfc6749#section-2.3 According to spec:
The client MUST NOT use more than one authentication method in each request.
Which means use Authorization header or Post body.
However, in reality, I always have to include authentication in the header.
In other words, ClientSecrectBasic
is always assured. ClientSecretPost
is optional.
Maybe consider an alternative implementation that boolean kind of data type is good enough.
Constructors
ClientSecretBasic | |
ClientSecretPost |
Instances
Eq ClientAuthenticationMethod Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods (==) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool (/=) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool | |
Ord ClientAuthenticationMethod Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods compare :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Ordering (<) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool (<=) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool (>) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool (>=) :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> Bool max :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> ClientAuthenticationMethod min :: ClientAuthenticationMethod -> ClientAuthenticationMethod -> ClientAuthenticationMethod |
Types Synonym
type QueryParams = [(ByteString, ByteString)] Source #
Utilies
defaultRequestHeaders :: [(HeaderName, ByteString)] Source #
appendQueryParams :: [(ByteString, ByteString)] -> URIRef a -> URIRef a Source #
uriToRequest :: MonadThrow m => URI -> m Request Source #
requestToUri :: Request -> URI Source #