This file is indexed.

/usr/lib/python2.7/dist-packages/social/backends/coursera.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
41
42
43
"""
Coursera OAuth2 backend, docs at:
    https://tech.coursera.org/app-platform/oauth2/
"""
from social.backends.oauth import BaseOAuth2


class CourseraOAuth2(BaseOAuth2):
    """Coursera OAuth2 authentication backend"""
    name = 'coursera'
    ID_KEY = 'username'
    AUTHORIZATION_URL = 'https://accounts.coursera.org/oauth2/v1/auth'
    ACCESS_TOKEN_URL = 'https://accounts.coursera.org/oauth2/v1/token'
    ACCESS_TOKEN_METHOD = 'POST'
    REDIRECT_STATE = False
    SCOPE_SEPARATOR = ','
    DEFAULT_SCOPE = ['view_profile']

    def _get_username_from_response(self, response):
        elements = response.get('elements', [])
        for element in elements:
            if 'id' in element:
                return element.get('id')

        return None

    def get_user_details(self, response):
        """Return user details from Coursera account"""
        return {'username': self._get_username_from_response(response)}

    def get_user_id(self, details, response):
        """Return a username prepared in get_user_details as uid"""
        return details.get(self.ID_KEY)

    def user_data(self, access_token, *args, **kwargs):
        """Load user data from the service"""
        return self.get_json(
            'https://api.coursera.org/api/externalBasicProfiles.v1?q=me',
            headers=self.get_auth_header(access_token)
        )

    def get_auth_header(self, access_token):
        return {'Authorization': 'Bearer {0}'.format(access_token)}