mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-04-26 20:57:48 +02:00
Add charId to credsExtra
This commit is contained in:
parent
5dcfbea1a0
commit
a6fc5ab03d
@ -7,7 +7,7 @@
|
|||||||
--
|
--
|
||||||
-- * Authenticates against eveonline
|
-- * Authenticates against eveonline
|
||||||
-- * Uses EVEs unique account-user-char-hash as credentials identifier
|
-- * Uses EVEs unique account-user-char-hash as credentials identifier
|
||||||
-- * Returns charName, tokenType, accessToken and expires as extras
|
-- * Returns charName, charId, tokenType, accessToken and expires as extras
|
||||||
--
|
--
|
||||||
module Yesod.Auth.OAuth2.EveOnline
|
module Yesod.Auth.OAuth2.EveOnline
|
||||||
( oauth2Eve
|
( oauth2Eve
|
||||||
@ -46,6 +46,7 @@ data EveUser = EveUser
|
|||||||
, eveUserExpire :: Text
|
, eveUserExpire :: Text
|
||||||
, eveTokenType :: Text
|
, eveTokenType :: Text
|
||||||
, eveCharOwnerHash :: Text
|
, eveCharOwnerHash :: Text
|
||||||
|
, eveCharId :: Integer
|
||||||
}
|
}
|
||||||
|
|
||||||
instance FromJSON EveUser where
|
instance FromJSON EveUser where
|
||||||
@ -54,6 +55,7 @@ instance FromJSON EveUser where
|
|||||||
<*> o .: "ExpiresOn"
|
<*> o .: "ExpiresOn"
|
||||||
<*> o .: "TokenType"
|
<*> o .: "TokenType"
|
||||||
<*> o .: "CharacterOwnerHash"
|
<*> o .: "CharacterOwnerHash"
|
||||||
|
<*> o .: "CharacterID"
|
||||||
|
|
||||||
parseJSON _ = mzero
|
parseJSON _ = mzero
|
||||||
|
|
||||||
@ -105,6 +107,7 @@ toCreds user token = Creds
|
|||||||
, credsIdent = T.pack $ show $ eveCharOwnerHash user
|
, credsIdent = T.pack $ show $ eveCharOwnerHash user
|
||||||
, credsExtra =
|
, credsExtra =
|
||||||
[ ("charName", eveUserName user)
|
[ ("charName", eveUserName user)
|
||||||
|
, ("charId", T.pack . show . eveCharId $ user)
|
||||||
, ("tokenType", eveTokenType user)
|
, ("tokenType", eveTokenType user)
|
||||||
, ("expires", eveUserExpire user)
|
, ("expires", eveUserExpire user)
|
||||||
, ("accessToken", decodeUtf8 . accessToken $ token)
|
, ("accessToken", decodeUtf8 . accessToken $ token)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user