diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2017-08-06 19:50:58 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2017-08-06 19:50:58 +0300 |
commit | ad1134ad752bbcd678cfb5a80217fabe57fdcd35 (patch) | |
tree | 62b14e42a0d37b748279d1ff7fabfa75a62da2dc /src/Sproxy/Application/OAuth2/Common.hs | |
parent | 7870f9db440cc091a15fa4fae646522cce65fb4b (diff) | |
download | sproxy2-ad1134ad752bbcd678cfb5a80217fabe57fdcd35.tar.gz |
Format with hindent
Diffstat (limited to 'src/Sproxy/Application/OAuth2/Common.hs')
-rw-r--r-- | src/Sproxy/Application/OAuth2/Common.hs | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/Sproxy/Application/OAuth2/Common.hs b/src/Sproxy/Application/OAuth2/Common.hs index 0324e62..ae96e68 100644 --- a/src/Sproxy/Application/OAuth2/Common.hs +++ b/src/Sproxy/Application/OAuth2/Common.hs @@ -1,40 +1,37 @@ {-# LANGUAGE OverloadedStrings #-} -module Sproxy.Application.OAuth2.Common ( - AccessTokenBody(..) -, OAuth2Client(..) -, OAuth2Provider -) where + +module Sproxy.Application.OAuth2.Common + ( AccessTokenBody(..) + , OAuth2Client(..) + , OAuth2Provider + ) where import Control.Applicative (empty) -import Data.Aeson (FromJSON, parseJSON, Value(Object), (.:)) -import Data.ByteString(ByteString) +import Data.Aeson (FromJSON, Value(Object), (.:), parseJSON) +import Data.ByteString (ByteString) import Data.Text (Text) import Sproxy.Application.Cookie (AuthUser) -data OAuth2Client = OAuth2Client { - oauth2Description :: String -, oauth2AuthorizeURL - :: ByteString -- state - -> ByteString -- redirect url - -> ByteString -, oauth2Authenticate - :: ByteString -- code - -> ByteString -- redirect url - -> IO AuthUser -} +data OAuth2Client = OAuth2Client + { oauth2Description :: String + , oauth2AuthorizeURL :: ByteString -- state + -> ByteString -- redirect url + -> ByteString + , oauth2Authenticate :: ByteString -- code + -> ByteString -- redirect url + -> IO AuthUser + } type OAuth2Provider = (ByteString, ByteString) -> OAuth2Client -- | RFC6749. We ignore optional token_type ("Bearer" from Google, omitted by LinkedIn) -- and expires_in because we don't use them, *and* expires_in creates troubles: -- it's an integer from Google and string from LinkedIn (sic!) -data AccessTokenBody = AccessTokenBody { - accessToken :: Text -} deriving (Eq, Show) +data AccessTokenBody = AccessTokenBody + { accessToken :: Text + } deriving (Eq, Show) instance FromJSON AccessTokenBody where - parseJSON (Object v) = AccessTokenBody - <$> v .: "access_token" + parseJSON (Object v) = AccessTokenBody <$> v .: "access_token" parseJSON _ = empty - |