yesod-auth-oauth2 0.1.9 → 0.1.10
raw patch · 5 files changed
+18/−20 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Yesod.Auth.OAuth2: maybeExtra :: Text -> Maybe Text -> [(Text, Text)]
Files
- Yesod/Auth/OAuth2.hs +7/−0
- Yesod/Auth/OAuth2/Github.hs +6/−12
- Yesod/Auth/OAuth2/Google.hs +2/−5
- Yesod/Auth/OAuth2/Spotify.hs +2/−2
- yesod-auth-oauth2.cabal +1/−1
Yesod/Auth/OAuth2.hs view
@@ -15,6 +15,7 @@ , oauth2Url , fromProfileURL , YesodOAuth2Exception(..)+ , maybeExtra , module Network.OAuth.OAuth2 ) where @@ -149,3 +150,9 @@ if '?' `C8.elem` url then url <> "&" <> query else url <> "?" <> query++-- | A helper for providing an optional value to credsExtra+--+maybeExtra :: Text -> Maybe Text -> [(Text, Text)]+maybeExtra k (Just v) = [(k, v)]+maybeExtra _ Nothing = []
Yesod/Auth/OAuth2/Github.hs view
@@ -37,7 +37,7 @@ , githubUserName :: Maybe Text , githubUserLogin :: Text , githubUserAvatarUrl :: Text- , githubUserLocation :: Text+ , githubUserLocation :: Maybe Text , githubUserPublicEmail :: Maybe Text } @@ -47,8 +47,8 @@ <*> o .:? "name" <*> o .: "login" <*> o .: "avatar_url"- <*> o .: "location"- <*> o .: "email"+ <*> o .:? "location"+ <*> o .:? "email" parseJSON _ = mzero @@ -104,18 +104,12 @@ [ ("email", githubUserEmailAddress email) , ("login", githubUserLogin user) , ("avatar_url", githubUserAvatarUrl user)- , ("location", githubUserLocation user) , ("access_token", decodeUtf8 $ accessToken token) ]- ++ maybeName (githubUserName user)- ++ maybePublicEmail (githubUserPublicEmail user)+ ++ maybeExtra "name" (githubUserName user)+ ++ maybeExtra "email" (githubUserPublicEmail user)+ ++ maybeExtra "location" (githubUserLocation user) } where email = fromMaybe (head userMails) $ find githubUserEmailPrimary userMails-- maybeName Nothing = []- maybeName (Just name) = [("name", name)]-- maybePublicEmail Nothing = []- maybePublicEmail (Just e) = [("public_email", e)]
Yesod/Auth/OAuth2/Google.hs view
@@ -29,7 +29,6 @@ import Control.Monad (mzero) import Data.Aeson import Data.Monoid ((<>))-import Data.Maybe (maybeToList) import Data.Text (Text) import Data.Text.Encoding (encodeUtf8, decodeUtf8) import Network.HTTP.Conduit (Manager)@@ -135,8 +134,6 @@ , ("family_name", googleUserFamilyName user) , ("avatar_url", googleUserPicture user) , ("access_token", decodeUtf8 $ accessToken token)- ] ++ maybeHostedDomain+ ]+ ++ maybeExtra "hosted_domain" (googleUserHostedDomain user) }-- where- maybeHostedDomain = maybeToList $ (,) "hosted_domain" <$> googleUserHostedDomain user
Yesod/Auth/OAuth2/Spotify.hs view
@@ -33,8 +33,8 @@ instance FromJSON SpotifyUserImage where parseJSON (Object v) = SpotifyUserImage- <$> v .: "height"- <*> v .: "width"+ <$> v .:? "height"+ <*> v .:? "width" <*> v .: "url" parseJSON _ = mzero
yesod-auth-oauth2.cabal view
@@ -1,5 +1,5 @@ name: yesod-auth-oauth2-version: 0.1.9+version: 0.1.10 license: BSD3 license-file: LICENSE author: Tom Streller