yesod-auth-oauth2-0.7.0.0: OAuth 2.0 authentication plugins
Safe HaskellNone
LanguageHaskell2010

Network.OAuth.OAuth2.Compat

Synopsis

Documentation

data OAuth2 #

Query Parameter Representation TODO: fix typo in OAuthorizeEndpoint rename AccessToken to TokenEndpoint rename callback to redirectUri

Instances

Instances details
Eq OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: OAuth2 -> OAuth2 -> Bool #

(/=) :: OAuth2 -> OAuth2 -> Bool #

Show OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Hashable OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

hashWithSalt :: Int -> OAuth2 -> Int #

hash :: OAuth2 -> Int #

authRequest #

Arguments

:: Request

Request to perform

-> (Request -> Request)

Modify request before sending

-> Manager

HTTP connection manager.

-> IO (Either ByteString ByteString) 

Send an HTTP request including the Authorization header with the specified access token.

authPostBS3 #

Arguments

:: Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> IO (Either ByteString ByteString)

Response as ByteString

Conduct POST request with access token in the header and null in body

authPostBS2 #

Arguments

:: Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> PostBody 
-> IO (Either ByteString ByteString)

Response as ByteString

Conduct POST request with access token in the request body rather header

authPostBS #

Arguments

:: Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> PostBody 
-> IO (Either ByteString ByteString)

Response as ByteString

Conduct POST request.

authPostJSON #

Arguments

:: FromJSON b 
=> Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> PostBody 
-> IO (Either ByteString b)

Response as JSON

Conduct POST request and return response as JSON.

authGetBS2 #

Arguments

:: Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> IO (Either ByteString ByteString)

Response as ByteString

same to authGetBS but set access token to query parameter rather than header

authGetBS #

Arguments

:: Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> IO (Either ByteString ByteString)

Response as ByteString

Conduct an authorized GET request.

authGetJSON #

Arguments

:: FromJSON b 
=> Manager

HTTP connection manager.

-> AccessToken 
-> URI 
-> IO (Either ByteString b)

Response as JSON

Conduct an authorized GET request and return response as JSON.

doSimplePostRequest #

Arguments

:: FromJSON err 
=> Manager

HTTP connection manager.

-> OAuth2

OAuth options

-> URI

URL

-> PostBody

Request body.

-> IO (OAuth2Result err ByteString)

Response as ByteString

Conduct post request.

refreshAccessToken2 #

Arguments

:: Manager

HTTP connection manager.

-> OAuth2

OAuth context

-> RefreshToken

refresh token gained after authorization

-> IO (OAuth2Result Errors OAuth2Token) 

Please read the docs of refreshAccessToken.

refreshAccessToken #

Arguments

:: Manager

HTTP connection manager.

-> OAuth2

OAuth context

-> RefreshToken

refresh token gained after authorization

-> IO (OAuth2Result Errors OAuth2Token) 

Fetch a new AccessToken with the Refresh Token with authentication in request header. OAuth2 spec allows client_id and client_secret to either be sent in the header (as basic authentication) OR as form/url params. The OAuth server can choose to implement only one, or both. Unfortunately, there is no way for the OAuth client (i.e. this library) to know which method to use. Please take a look at the documentation of the service that you are integrating with and either use refreshAccessToken or refreshAccessToken2

accessTokenToParam :: AccessToken -> [(ByteString, ByteString)] #

Create QueryParams with given access token value.

appendAccessToken #

Arguments

:: URIRef a

Base URI

-> AccessToken

Authorized Access Token

-> URIRef a

Combined Result

For GET method API.

refreshAccessTokenUrl #

Arguments

:: OAuth2 
-> RefreshToken

refresh token gained via authorization URL

-> (URI, PostBody)

refresh token request URL plus the request body.

Using a Refresh Token. Obtain a new access token by sending a refresh token to the Authorization server.

accessTokenUrl' #

Arguments

:: OAuth2 
-> ExchangeToken

access code gained via authorization URL

-> Maybe Text

Grant Type

-> (URI, PostBody)

access token request URL plus the request body.

Prepare the URL and the request body query for fetching an access token, with optional grant type.

accessTokenUrl #

Arguments

:: OAuth2 
-> ExchangeToken

access code gained via authorization URL

-> (URI, PostBody)

access token request URL plus the request body.

Prepare the URL and the request body query for fetching an access token.

data OAuth2 #

Query Parameter Representation TODO: fix typo in OAuthorizeEndpoint rename AccessToken to TokenEndpoint rename callback to redirectUri

Instances

Instances details
Eq OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: OAuth2 -> OAuth2 -> Bool #

(/=) :: OAuth2 -> OAuth2 -> Bool #

Show OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Hashable OAuth2 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

hashWithSalt :: Int -> OAuth2 -> Int #

hash :: OAuth2 -> Int #

newtype IdToken #

Constructors

IdToken 

Fields

Instances

Instances details
Eq IdToken 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

(==) :: IdToken -> IdToken -> Bool #

(/=) :: IdToken -> IdToken -> Bool #

Show IdToken 
Instance details

Defined in Network.OAuth.OAuth2.Internal

ToJSON IdToken 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON IdToken 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Binary IdToken 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Methods

put :: IdToken -> Put #

get :: Get IdToken #

putList :: [IdToken] -> Put #

data OAuth2Token #

The gained Access Token. Use Data.Aeson.decode to decode string to AccessToken. The refreshToken is special in some cases, e.g. https://developers.google.com/accounts/docs/OAuth2

Instances

Instances details
Eq OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Show OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Generic OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Associated Types

type Rep OAuth2Token :: Type -> Type #

ToJSON OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON OAuth2Token

Parse JSON data into OAuth2Token

Instance details

Defined in Network.OAuth.OAuth2.Internal

Binary OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep OAuth2Token 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep OAuth2Token = D1 ('MetaData "OAuth2Token" "Network.OAuth.OAuth2.Internal" "hoauth2-2.0.0-DY5jodbUcC4AiL00MUihEx" '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 #

Instances

Instances details
Eq a => Eq (OAuth2Error a) 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Show a => Show (OAuth2Error a) 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Generic (OAuth2Error a) 
Instance details

Defined in Network.OAuth.OAuth2.Internal

Associated Types

type Rep (OAuth2Error a) :: Type -> Type #

Methods

from :: OAuth2Error a -> Rep (OAuth2Error a) x #

to :: Rep (OAuth2Error a) x -> OAuth2Error a #

ToJSON err => ToJSON (OAuth2Error err) 
Instance details

Defined in Network.OAuth.OAuth2.Internal

FromJSON err => FromJSON (OAuth2Error err) 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep (OAuth2Error a) 
Instance details

Defined in Network.OAuth.OAuth2.Internal

type Rep (OAuth2Error a) = D1 ('MetaData "OAuth2Error" "Network.OAuth.OAuth2.Internal" "hoauth2-2.0.0-DY5jodbUcC4AiL00MUihEx" '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))))))

type OAuth2Result err a = Either (OAuth2Error err) a #

Is either Left containing an error or Right containg a result

type PostBody = [(ByteString, ByteString)] #

type synonym of post body content