This file is indexed.

/usr/lib/python2.7/dist-packages/social/backends/jawbone.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
Jawbone OAuth2 backend, docs at:
    http://psa.matiasaguirre.net/docs/backends/jawbone.html
"""
from social.utils import handle_http_errors
from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthCanceled, AuthUnknownError


class JawboneOAuth2(BaseOAuth2):
    name = 'jawbone'
    AUTHORIZATION_URL = 'https://jawbone.com/auth/oauth2/auth'
    ACCESS_TOKEN_URL = 'https://jawbone.com/auth/oauth2/token'
    SCOPE_SEPARATOR = ' '
    REDIRECT_STATE = False

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

    def get_user_details(self, response):
        """Return user details from Jawbone account"""
        data = response['data']
        fullname, first_name, last_name = self.get_user_names(
            first_name=data.get('first', ''),
            last_name=data.get('last', '')
        )
        return {
            'username': first_name + ' ' + last_name,
            'fullname': fullname,
            'first_name': first_name,
            'last_name': last_name,
            'dob': data.get('dob', ''),
            'gender': data.get('gender', ''),
            'height': data.get('height', ''),
            'weight': data.get('weight', '')
        }

    def user_data(self, access_token, *args, **kwargs):
        """Loads user data from service"""
        return self.get_json(
            'https://jawbone.com/nudge/api/users/@me',
            headers={'Authorization': 'Bearer ' + access_token},
        )

    def process_error(self, data):
        error = data.get('error')
        if error:
            if error == 'access_denied':
                raise AuthCanceled(self)
            else:
                raise AuthUnknownError(self, 'Jawbone error was {0}'.format(
                    error
                ))
        return super(JawboneOAuth2, self).process_error(data)

    def auth_complete_params(self, state=None):
        client_id, client_secret = self.get_key_and_secret()
        return {
            'grant_type': 'authorization_code',  # request auth code
            'code': self.data.get('code', ''),  # server response code
            'client_id': client_id,
            'client_secret': client_secret,
        }

    @handle_http_errors
    def auth_complete(self, *args, **kwargs):
        """Completes loging process, must return user instance"""
        self.process_error(self.data)
        response = self.request_access_token(
            self.ACCESS_TOKEN_URL,
            params=self.auth_complete_params(self.validate_state()),
            headers=self.auth_headers(),
            method=self.ACCESS_TOKEN_METHOD
        )
        self.process_error(response)
        return self.do_auth(response['access_token'], response=response,
                            *args, **kwargs)