/usr/lib/python3/dist-packages/social/backends/steam.py is in python3-social-auth 0.2.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """
Steam OpenId backend, docs at:
http://psa.matiasaguirre.net/docs/backends/steam.html
"""
from social.backends.open_id import OpenIdAuth
from social.exceptions import AuthFailed
USER_INFO = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?'
class SteamOpenId(OpenIdAuth):
name = 'steam'
URL = 'https://steamcommunity.com/openid'
def get_user_id(self, details, response):
"""Return user unique id provided by service"""
return self._user_id(response)
def get_user_details(self, response):
player = self.get_json(USER_INFO, params={
'key': self.setting('API_KEY'),
'steamids': self._user_id(response)
})
if len(player['response']['players']) > 0:
player = player['response']['players'][0]
details = {'username': player.get('personaname'),
'email': '',
'fullname': '',
'first_name': '',
'last_name': '',
'player': player}
else:
details = {}
return details
def consumer(self):
# Steam seems to support stateless mode only, ignore store
if not hasattr(self, '_consumer'):
self._consumer = self.create_consumer()
return self._consumer
def _user_id(self, response):
user_id = response.identity_url.rsplit('/', 1)[-1]
if not user_id.isdigit():
raise AuthFailed(self, 'Missing Steam Id')
return user_id
|