Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Network.OAuth.OAuth2
Contents
Description
A lightweight oauth2 Haskell binding. See Readme for more details
Synopsis
- module Network.OAuth.OAuth2.HttpClient
- authorizationUrl :: OAuth2 -> URI
- authorizationUrlWithParams :: QueryParams -> OAuth2 -> URI
- module Network.OAuth.OAuth2.TokenRequest
- data OAuth2 = OAuth2 {
- oauth2ClientId :: Text
- oauth2ClientSecret :: Text
- oauth2AuthorizeEndpoint :: URIRef Absolute
- oauth2TokenEndpoint :: URIRef Absolute
- oauth2RedirectUri :: URIRef Absolute
- newtype AccessToken = AccessToken {}
- newtype RefreshToken = RefreshToken {}
- newtype IdToken = IdToken {}
- newtype ExchangeToken = ExchangeToken {}
- data OAuth2Token = OAuth2Token {}
- 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
Documentation
authorizationUrl :: OAuth2 -> URI Source #
authorizationUrlWithParams :: QueryParams -> OAuth2 -> URI Source #
Prepare the authorization URL. Redirect to this URL asking for user interactive authentication.
Since: 2.6.0
Data Types
Query Parameter Representation
Constructors
OAuth2 | |
Fields
|
newtype AccessToken Source #
Constructors
AccessToken | |
Instances
FromJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods parseJSON :: Value -> Parser AccessToken Source # parseJSONList :: Value -> Parser [AccessToken] Source # | |
ToJSON AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: AccessToken -> Value Source # toEncoding :: AccessToken -> Encoding Source # toJSONList :: [AccessToken] -> Value Source # toEncodingList :: [AccessToken] -> Encoding Source # | |
Show AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
Binary AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods put :: AccessToken -> Put Source # get :: Get AccessToken Source # putList :: [AccessToken] -> Put Source # | |
Eq AccessToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods (==) :: AccessToken -> AccessToken -> Bool Source # (/=) :: AccessToken -> AccessToken -> Bool Source # |
newtype RefreshToken Source #
Constructors
RefreshToken | |
Instances
newtype ExchangeToken Source #
Authorization Code
Constructors
ExchangeToken | |
Instances
FromJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods parseJSON :: Value -> Parser ExchangeToken Source # parseJSONList :: Value -> Parser [ExchangeToken] Source # | |
ToJSON ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal Methods toJSON :: ExchangeToken -> Value Source # toEncoding :: ExchangeToken -> Encoding Source # toJSONList :: [ExchangeToken] -> Value Source # toEncodingList :: [ExchangeToken] -> Encoding Source # | |
Show ExchangeToken Source # | |
Defined in Network.OAuth.OAuth2.Internal | |
ToQueryParam ExchangeToken Source # | |
Defined in Network.OAuth2.Experiment.Types Methods toQueryParam :: ExchangeToken -> Map Text Text Source # |
data OAuth2Token Source #
Constructors
OAuth2Token | |
Fields
|
Instances
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 | |
ClientAssertionJwt |
Instances
Types Synonym
type PostBody = [(ByteString, ByteString)] Source #
type synonym of post body content
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 #