| Copyright | (c) Joseph Abrahamson 2013 |
|---|---|
| License | MIT |
| Maintainer | me@jspha.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.OAuth.ThreeLegged
Description
The "Three-legged OAuth" protocol implementing RFC 5849's Redirection-Based Authorization.
Synopsis
- data ThreeLegged = ThreeLegged {}
- parseThreeLegged :: String -> String -> String -> Callback -> Maybe ThreeLegged
- data Callback
- type Verifier = ByteString
- requestTemporaryToken :: (MonadIO m, MonadRandom m) => Cred Client -> Server -> ThreeLegged -> Manager -> m (Response (Either ByteString (Token Temporary)))
- buildAuthorizationUrl :: Cred Temporary -> ThreeLegged -> URI
- requestPermanentToken :: (MonadIO m, MonadRandom m) => Cred Temporary -> Server -> Verifier -> ThreeLegged -> Manager -> m (Response (Either ByteString (Token Permanent)))
- requestTemporaryTokenRaw :: (MonadIO m, MonadRandom m) => Cred Client -> Server -> ThreeLegged -> Manager -> m (Response ByteString)
- requestPermanentTokenRaw :: (MonadIO m, MonadRandom m) => Cred Temporary -> Server -> Verifier -> ThreeLegged -> Manager -> m (Response ByteString)
- requestTokenProtocol :: (MonadIO m, MonadRandom m) => Cred Client -> Server -> ThreeLegged -> (URI -> m Verifier) -> m (Maybe (Cred Permanent))
- requestTokenProtocol' :: (MonadIO m, MonadRandom m) => ManagerSettings -> Cred Client -> Server -> ThreeLegged -> (URI -> m Verifier) -> m (Maybe (Cred Permanent))
Configuration types
data ThreeLegged Source #
Data parameterizing the "Three-legged OAuth" redirection-based authorization protocol. These parameters cover the protocol as described in the community editions OAuth Core 1.0 and OAuth Core 1.0a as well as RFC 5849.
Constructors
| ThreeLegged | |
Fields
| |
Instances
| Show ThreeLegged Source # | |
Defined in Network.OAuth.ThreeLegged Methods showsPrec :: Int -> ThreeLegged -> ShowS # show :: ThreeLegged -> String # showList :: [ThreeLegged] -> ShowS # | |
parseThreeLegged :: String -> String -> String -> Callback -> Maybe ThreeLegged Source #
Convenience method for creating a ThreeLegged configuration from
a trio of URLs and a Callback. Returns Nothing if one of the
callback URLs could not be parsed correctly.
When performing the second leg of the three-leg token request workflow,
the user must pass the oauth_verifier code back to the client. In order to
ensure that this protocol is secure, OAuth demands that the client
associates this "callback method" with the temporary credentials generated
for the workflow. This Callback method may be a URL where the parameters
are returned to or the string "oob" which indicates that the user is
responsible for returning the oauth_verifier to the client OutOfBand.
Instances
| Show Callback Source # | |
| QueryValueLike Callback Source # | Prints out in Epoch time format, a printed integer |
Defined in Network.OAuth.Types.Params Methods toQueryValue :: Callback -> Maybe ByteString # | |
type Verifier = ByteString Source #
Actions
requestTemporaryToken :: (MonadIO m, MonadRandom m) => Cred Client -> Server -> ThreeLegged -> Manager -> m (Response (Either ByteString (Token Temporary))) Source #
Returns the raw result if the Response could not be parsed as
a valid Token. Importantly, in RFC 5849 compliant modes this
requires that the token response includes callback_confirmed=true. See
also requestTemporaryTokenRaw.
Throws HttpExceptions.
buildAuthorizationUrl :: Cred Temporary -> ThreeLegged -> URI Source #
Produce a URI which the user should be directed to in order to
authorize a set of Temporary Creds.
requestPermanentToken :: (MonadIO m, MonadRandom m) => Cred Temporary -> Server -> Verifier -> ThreeLegged -> Manager -> m (Response (Either ByteString (Token Permanent))) Source #
Returns Nothing if the response could not be decoded as a Token.
See also requestPermanentTokenRaw.
Throws HttpExceptions.
Raw forms
requestTemporaryTokenRaw :: (MonadIO m, MonadRandom m) => Cred Client -> Server -> ThreeLegged -> Manager -> m (Response ByteString) Source #
Request a Temporary Token based on the parameters of
a ThreeLegged protocol. This returns the raw response which should be
encoded as www-form-urlencoded.
Throws HttpExceptions.
requestPermanentTokenRaw :: (MonadIO m, MonadRandom m) => Cred Temporary -> Server -> Verifier -> ThreeLegged -> Manager -> m (Response ByteString) Source #
Request a 'Permanent Token based on the parameters of
a ThreeLegged protocol. This returns the raw response which should be
encoded as www-form-urlencoded.
Throws HttpExceptions.
Example system
requestTokenProtocol :: (MonadIO m, MonadRandom m) => Cred Client -> Server -> ThreeLegged -> (URI -> m Verifier) -> m (Maybe (Cred Permanent)) Source #
Performs an interactive token request provided credentials,
configuration, and a way to convert a user authorization URI into
a Verifier out of band. Does not use any kind of TLS protection---it
will throw a TlsNotSupported exception if TLS is required.
Throws HttpExceptions.
requestTokenProtocol' :: (MonadIO m, MonadRandom m) => ManagerSettings -> Cred Client -> Server -> ThreeLegged -> (URI -> m Verifier) -> m (Maybe (Cred Permanent)) Source #
Like requestTokenProtocol but allows for specification of the
ManagerSettings.