/usr/lib/python3/dist-packages/social/backends/mineid.py is in python3-social-auth 1:0.2.21+dfsg-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 | from social.backends.oauth import BaseOAuth2
class MineIDOAuth2(BaseOAuth2):
"""MineID OAuth2 authentication backend"""
name = 'mineid'
_AUTHORIZATION_URL = '%(scheme)s://%(host)s/oauth/authorize'
_ACCESS_TOKEN_URL = '%(scheme)s://%(host)s/oauth/access_token'
ACCESS_TOKEN_METHOD = 'POST'
SCOPE_SEPARATOR = ','
EXTRA_DATA = [
]
def get_user_details(self, response):
"""Return user details"""
return {'email': response.get('email'),
'username': response.get('email')}
def user_data(self, access_token, *args, **kwargs):
return self._user_data(access_token)
def _user_data(self, access_token, path=None):
url = '%(scheme)s://%(host)s/api/user' % self.get_mineid_url_params()
return self.get_json(url, params={'access_token': access_token})
@property
def AUTHORIZATION_URL(self):
return self._AUTHORIZATION_URL % self.get_mineid_url_params()
@property
def ACCESS_TOKEN_URL(self):
return self._ACCESS_TOKEN_URL % self.get_mineid_url_params()
def get_mineid_url_params(self):
return {
'host': self.setting('HOST', 'www.mineid.org'),
'scheme': self.setting('SCHEME', 'https'),
}
|