diff --git a/Yesod/Auth/OAuth2/EveOnline.hs b/Yesod/Auth/OAuth2/EveOnline.hs index 3c42a92..895b07f 100644 --- a/Yesod/Auth/OAuth2/EveOnline.hs +++ b/Yesod/Auth/OAuth2/EveOnline.hs @@ -33,11 +33,12 @@ import Yesod.Auth.OAuth2 import qualified Data.Text as T -data ImageType = BigWhite - | SmallWhite - | BigBlack - | SmallBlack - | Custom Text +data ImageType + = BigWhite + | SmallWhite + | BigBlack + | SmallBlack + | Custom Text data EveUser = EveUser { eveUserId :: Int @@ -60,31 +61,31 @@ instance FromJSON EveUser where parseJSON _ = mzero oauth2Eve :: YesodAuth m - => Text -- ^ Client ID - -> Text -- ^ Client Secret - -> AuthPlugin m + => Text -- ^ Client ID + -> Text -- ^ Client Secret + -> AuthPlugin m oauth2Eve clientId clientSecret = oauth2EveScoped clientId clientSecret ["publicData"] Nothing oauth2EveImage :: YesodAuth m - => Text -- ^ Client ID - -> Text -- ^ Client Secret - -> ImageType - -> AuthPlugin m + => Text -- ^ Client ID + -> Text -- ^ Client Secret + -> ImageType + -> AuthPlugin m oauth2EveImage clientId clientSecret im = oauth2EveScoped clientId clientSecret ["publicData"] (Just . toURI $ im) - where - toURI :: ImageType -> Text - toURI BigWhite = "https://images.contentful.com/idjq7aai9ylm/4PTzeiAshqiM8osU2giO0Y/5cc4cb60bac52422da2e45db87b6819c/EVE_SSO_Login_Buttons_Large_White.png?w=270&h=45" - toURI BigBlack = "https://images.contentful.com/idjq7aai9ylm/4fSjj56uD6CYwYyus4KmES/4f6385c91e6de56274d99496e6adebab/EVE_SSO_Login_Buttons_Large_Black.png?w=270&h=45" - toURI SmallWhite = "https://images.contentful.com/idjq7aai9ylm/18BxKSXCymyqY4QKo8KwKe/c2bdded6118472dd587c8107f24104d7/EVE_SSO_Login_Buttons_Small_White.png?w=195&h=30" - toURI SmallBlack = "https://images.contentful.com/idjq7aai9ylm/12vrPsIMBQi28QwCGOAqGk/33234da7672c6b0cdca394fc8e0b1c2b/EVE_SSO_Login_Buttons_Small_Black.png?w=195&h=30" - toURI (Custom a) = a + where + toURI :: ImageType -> Text + toURI BigWhite = "https://images.contentful.com/idjq7aai9ylm/4PTzeiAshqiM8osU2giO0Y/5cc4cb60bac52422da2e45db87b6819c/EVE_SSO_Login_Buttons_Large_White.png?w=270&h=45" + toURI BigBlack = "https://images.contentful.com/idjq7aai9ylm/4fSjj56uD6CYwYyus4KmES/4f6385c91e6de56274d99496e6adebab/EVE_SSO_Login_Buttons_Large_Black.png?w=270&h=45" + toURI SmallWhite = "https://images.contentful.com/idjq7aai9ylm/18BxKSXCymyqY4QKo8KwKe/c2bdded6118472dd587c8107f24104d7/EVE_SSO_Login_Buttons_Small_White.png?w=195&h=30" + toURI SmallBlack = "https://images.contentful.com/idjq7aai9ylm/12vrPsIMBQi28QwCGOAqGk/33234da7672c6b0cdca394fc8e0b1c2b/EVE_SSO_Login_Buttons_Small_Black.png?w=195&h=30" + toURI (Custom a) = a oauth2EveScoped :: YesodAuth m - => Text -- ^ Client ID - -> Text -- ^ Client Secret - -> [Text] -- ^ List of scopes to request - -> Maybe Text -- ^ Login-Image - -> AuthPlugin m + => Text -- ^ Client ID + -> Text -- ^ Client Secret + -> [Text] -- ^ List of scopes to request + -> Maybe Text -- ^ Login-Image + -> AuthPlugin m oauth2EveScoped clientId clientSecret scopes = authOAuth2Image "eveonline" oauth fetchEveProfile where oauth = OAuth2