/usr/lib/python2.7/dist-packages/social/backends/behance.py is in python-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 39 40 | """
Behance OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/behance.html
"""
from social.backends.oauth import BaseOAuth2
class BehanceOAuth2(BaseOAuth2):
"""Behance OAuth authentication backend"""
name = 'behance'
AUTHORIZATION_URL = 'https://www.behance.net/v2/oauth/authenticate'
ACCESS_TOKEN_URL = 'https://www.behance.net/v2/oauth/token'
ACCESS_TOKEN_METHOD = 'POST'
SCOPE_SEPARATOR = '|'
EXTRA_DATA = [('username', 'username')]
REDIRECT_STATE = False
def get_user_id(self, details, response):
return response['user']['id']
def get_user_details(self, response):
"""Return user details from Behance account"""
user = response['user']
fullname, first_name, last_name = self.get_user_names(
user['display_name'], user['first_name'], user['last_name']
)
return {'username': user['username'],
'fullname': fullname,
'first_name': first_name,
'last_name': last_name,
'email': ''}
def extra_data(self, user, uid, response, details=None, *args, **kwargs):
# Pull up the embedded user attributes so they can be found as extra
# data. See the example token response for possible attributes:
# http://www.behance.net/dev/authentication#step-by-step
data = response.copy()
data.update(response['user'])
return super(BehanceOAuth2, self).extra_data(user, uid, data, details,
*args, **kwargs)
|