This file is indexed.

/usr/share/pyshared/social_auth/backends/contrib/mixcloud.py is in python-django-social-auth 0.7.23-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
48
49
50
51
52
"""
Mixcloud OAuth2 support
"""
from urllib import urlencode
from urllib2 import Request

from django.utils import simplejson

from social_auth.backends import BaseOAuth2, OAuthBackend
from social_auth.utils import dsa_urlopen


MIXCLOUD_PROFILE_URL = 'https://api.mixcloud.com/me/'


class MixcloudBackend(OAuthBackend):
    name = 'mixcloud'

    def get_user_id(self, details, response):
        return response['username']

    def get_user_details(self, response):
        return {'username': response['username'],
                'email': None,
                'fullname': response['name'],
                'first_name': None,
                'last_name': None}


class MixcloudOAuth2(BaseOAuth2):
    AUTH_BACKEND = MixcloudBackend
    AUTHORIZATION_URL = 'https://www.mixcloud.com/oauth/authorize'
    ACCESS_TOKEN_URL = 'https://www.mixcloud.com/oauth/access_token'
    SETTINGS_KEY_NAME = 'MIXCLOUD_CLIENT_ID'
    SETTINGS_SECRET_NAME = 'MIXCLOUD_CLIENT_SECRET'

    def user_data(self, access_token, *args, **kwargs):
        return mixcloud_profile(access_token)


def mixcloud_profile(access_token):
    data = {'access_token': access_token, 'alt': 'json'}
    request = Request(MIXCLOUD_PROFILE_URL + '?' + urlencode(data))
    try:
        return simplejson.loads(dsa_urlopen(request).read())
    except (ValueError, KeyError, IOError):
        return None


BACKENDS = {
    'mixcloud': MixcloudOAuth2,
}