mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-04-28 21:57:46 +02:00
Restyled by stylish-haskell
This commit is contained in:
parent
23b73d590d
commit
dfded079c4
@ -28,21 +28,17 @@ module Yesod.Auth.OAuth2
|
|||||||
, getUserResponseJSON
|
, getUserResponseJSON
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Error.Util ( note )
|
import Control.Error.Util (note)
|
||||||
import Control.Monad ( (<=<) )
|
import Control.Monad ((<=<))
|
||||||
import Data.Aeson ( FromJSON
|
import Data.Aeson (FromJSON, eitherDecode)
|
||||||
, eitherDecode
|
import Data.ByteString.Lazy (ByteString, fromStrict)
|
||||||
)
|
import Data.Text (Text)
|
||||||
import Data.ByteString.Lazy ( ByteString
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
, fromStrict
|
import Network.HTTP.Conduit (Manager)
|
||||||
)
|
import Network.OAuth.OAuth2.Compat
|
||||||
import Data.Text ( Text )
|
import Yesod.Auth
|
||||||
import Data.Text.Encoding ( encodeUtf8 )
|
import Yesod.Auth.OAuth2.Dispatch
|
||||||
import Network.HTTP.Conduit ( Manager )
|
import Yesod.Core.Widget
|
||||||
import Network.OAuth.OAuth2.Compat
|
|
||||||
import Yesod.Auth
|
|
||||||
import Yesod.Auth.OAuth2.Dispatch
|
|
||||||
import Yesod.Core.Widget
|
|
||||||
|
|
||||||
oauth2Url :: Text -> AuthRoute
|
oauth2Url :: Text -> AuthRoute
|
||||||
oauth2Url name = PluginR name ["forward"]
|
oauth2Url name = PluginR name ["forward"]
|
||||||
|
|||||||
@ -11,8 +11,8 @@ module Yesod.Auth.OAuth2.AzureAD
|
|||||||
, oauth2AzureADScoped
|
, oauth2AzureADScoped
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Prelude
|
import Prelude
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -13,13 +13,10 @@ module Yesod.Auth.OAuth2.BattleNet
|
|||||||
, oAuth2BattleNet
|
, oAuth2BattleNet
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T (pack, toLower)
|
||||||
( pack
|
import Yesod.Core.Widget
|
||||||
, toLower
|
|
||||||
)
|
|
||||||
import Yesod.Core.Widget
|
|
||||||
|
|
||||||
newtype User = User Int
|
newtype User = User Int
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,9 @@ module Yesod.Auth.OAuth2.Bitbucket
|
|||||||
, oauth2BitbucketScoped
|
, oauth2BitbucketScoped
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -5,9 +5,9 @@ module Yesod.Auth.OAuth2.ClassLink
|
|||||||
, oauth2ClassLinkScoped
|
, oauth2ClassLinkScoped
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
newtype User = User Int
|
newtype User = User Int
|
||||||
|
|
||||||
|
|||||||
@ -12,21 +12,20 @@ module Yesod.Auth.OAuth2.Dispatch
|
|||||||
, dispatchAuthRequest
|
, dispatchAuthRequest
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad.Except
|
import Control.Monad.Except
|
||||||
import Data.Text ( Text )
|
import Data.Text (Text)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Data.Text.Encoding ( encodeUtf8 )
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
import Network.HTTP.Conduit ( Manager )
|
import Network.HTTP.Conduit (Manager)
|
||||||
import Network.OAuth.OAuth2.Compat
|
import Network.OAuth.OAuth2.Compat
|
||||||
import Network.OAuth.OAuth2.TokenRequest
|
import Network.OAuth.OAuth2.TokenRequest (Errors)
|
||||||
( Errors )
|
import URI.ByteString.Extension
|
||||||
import URI.ByteString.Extension
|
import UnliftIO.Exception
|
||||||
import UnliftIO.Exception
|
import Yesod.Auth hiding (ServerError)
|
||||||
import Yesod.Auth hiding ( ServerError )
|
import Yesod.Auth.OAuth2.DispatchError
|
||||||
import Yesod.Auth.OAuth2.DispatchError
|
import Yesod.Auth.OAuth2.ErrorResponse
|
||||||
import Yesod.Auth.OAuth2.ErrorResponse
|
import Yesod.Auth.OAuth2.Random
|
||||||
import Yesod.Auth.OAuth2.Random
|
import Yesod.Core hiding (ErrorResponse)
|
||||||
import Yesod.Core hiding ( ErrorResponse )
|
|
||||||
|
|
||||||
-- | How to fetch an @'OAuth2Token'@
|
-- | How to fetch an @'OAuth2Token'@
|
||||||
--
|
--
|
||||||
|
|||||||
@ -13,10 +13,10 @@ module Yesod.Auth.OAuth2.EveOnline
|
|||||||
, WidgetType(..)
|
, WidgetType(..)
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Yesod.Core.Widget
|
import Yesod.Core.Widget
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,9 @@ module Yesod.Auth.OAuth2.GitHub
|
|||||||
, oauth2GitHubScoped
|
, oauth2GitHubScoped
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
newtype User = User Int
|
newtype User = User Int
|
||||||
|
|
||||||
|
|||||||
@ -6,9 +6,9 @@ module Yesod.Auth.OAuth2.GitLab
|
|||||||
, defaultScopes
|
, defaultScopes
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
newtype User = User Int
|
newtype User = User Int
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,8 @@ module Yesod.Auth.OAuth2.Google
|
|||||||
, oauth2GoogleScopedWidget
|
, oauth2GoogleScopedWidget
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
import Yesod.Core ( WidgetFor
|
import Yesod.Core (WidgetFor, whamlet)
|
||||||
, whamlet
|
|
||||||
)
|
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,13 @@ module Yesod.Auth.OAuth2.Nylas
|
|||||||
( oauth2Nylas
|
( oauth2Nylas
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import Control.Monad ( unless )
|
import Control.Monad (unless)
|
||||||
import qualified Data.ByteString.Lazy.Char8 as BL8
|
import qualified Data.ByteString.Lazy.Char8 as BL8
|
||||||
import Network.HTTP.Client
|
import Network.HTTP.Client
|
||||||
import qualified Network.HTTP.Types as HT
|
import qualified Network.HTTP.Types as HT
|
||||||
import qualified Yesod.Auth.OAuth2.Exception as YesodOAuth2Exception
|
import qualified Yesod.Auth.OAuth2.Exception as YesodOAuth2Exception
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -56,20 +56,20 @@ module Yesod.Auth.OAuth2.Prelude
|
|||||||
, authOAuth2Widget
|
, authOAuth2Widget
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString (ByteString)
|
||||||
import qualified Data.ByteString.Lazy as BL
|
import qualified Data.ByteString.Lazy as BL
|
||||||
import Data.Text ( Text )
|
import Data.Text (Text)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Data.Text.Encoding
|
import Data.Text.Encoding
|
||||||
import Network.HTTP.Conduit
|
import Network.HTTP.Conduit
|
||||||
import Network.OAuth.OAuth2.Compat
|
import Network.OAuth.OAuth2.Compat
|
||||||
import URI.ByteString
|
import URI.ByteString
|
||||||
import URI.ByteString.Extension
|
import URI.ByteString.Extension
|
||||||
import Yesod.Auth
|
import Yesod.Auth
|
||||||
import Yesod.Auth.OAuth2
|
import Yesod.Auth.OAuth2
|
||||||
import qualified Yesod.Auth.OAuth2.Exception as YesodOAuth2Exception
|
import qualified Yesod.Auth.OAuth2.Exception as YesodOAuth2Exception
|
||||||
|
|
||||||
-- | Retrieve a user's profile as JSON
|
-- | Retrieve a user's profile as JSON
|
||||||
--
|
--
|
||||||
|
|||||||
@ -13,7 +13,7 @@ module Yesod.Auth.OAuth2.Salesforce
|
|||||||
, oauth2SalesforceSandboxScoped
|
, oauth2SalesforceSandboxScoped
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -11,14 +11,11 @@ module Yesod.Auth.OAuth2.Slack
|
|||||||
, oauth2SlackScoped
|
, oauth2SlackScoped
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import Network.HTTP.Client ( httpLbs
|
import Network.HTTP.Client
|
||||||
, parseUrlThrow
|
(httpLbs, parseUrlThrow, responseBody, setQueryString)
|
||||||
, responseBody
|
import Yesod.Auth.OAuth2.Exception as YesodOAuth2Exception
|
||||||
, setQueryString
|
|
||||||
)
|
|
||||||
import Yesod.Auth.OAuth2.Exception as YesodOAuth2Exception
|
|
||||||
|
|
||||||
data SlackScope
|
data SlackScope
|
||||||
= SlackBasicScope
|
= SlackBasicScope
|
||||||
|
|||||||
@ -7,7 +7,7 @@ module Yesod.Auth.OAuth2.Spotify
|
|||||||
( oauth2Spotify
|
( oauth2Spotify
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
newtype User = User Text
|
newtype User = User Text
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,9 @@ module Yesod.Auth.OAuth2.Upcase
|
|||||||
( oauth2Upcase
|
( oauth2Upcase
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
newtype User = User Int
|
newtype User = User Int
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ module Yesod.Auth.OAuth2.WordPressDotCom
|
|||||||
( oauth2WordPressDotCom
|
( oauth2WordPressDotCom
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Yesod.Auth.OAuth2.Prelude
|
import Yesod.Auth.OAuth2.Prelude
|
||||||
|
|
||||||
pluginName :: Text
|
pluginName :: Text
|
||||||
pluginName = "WordPress.com"
|
pluginName = "WordPress.com"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user