~feng-kylin/youker-assistant/youker-assistant

« back to all changes in this revision

Viewing changes to backends/youker-assistant-daemon/src/sso/piston/ubuntusso_pristine.py

  • Committer: lixiang
  • Date: 2018-03-06 03:13:06 UTC
  • Revision ID: lixiang@kylinos.cn-20180306031306-fd7qnru3vm4a1xjd
Rewrite with Qt5, and add system monitor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from piston_mini_client import PistonAPI, returns_json
2
 
from piston_mini_client.validators import oauth_protected
3
 
 
4
 
# These are factored out as constants for if you need to work against a
5
 
# server that doesn't support both schemes (like http-only dev servers)
6
 
PUBLIC_API_SCHEME = 'http'
7
 
AUTHENTICATED_API_SCHEME = 'https'
8
 
 
9
 
 
10
 
# this is only here because:
11
 
#  a) ubuntu-sso-client does not support verifying if the credentials
12
 
#     are still valid
13
 
#  b) the restful client interface is not really needed because we just
14
 
#     need this one single call
15
 
class UbuntuSsoAPI(PistonAPI):
16
 
    default_service_root = 'http://localhost:8000/api/2.0'
17
 
 
18
 
    @oauth_protected
19
 
    @returns_json
20
 
    def whoami(self, id=None):
21
 
        # return self._get('accounts?ws.op=me',
22
 
        #                  scheme=AUTHENTICATED_API_SCHEME)
23
 
        return self._get('accounts?ws.op=me')