Exemplo n.º 1
0
 def __init__(self):
     super(object, self).__init__()
     self.username = None
     if type(self.account_manager) == dict:
         self.account_manager = Bunch(**self.account_manager)
     request = pico.get_request()
     if 'HTTP_AUTHORIZATION' in request:
         try:
             auth_header = request.get('HTTP_AUTHORIZATION')
             scheme, data = auth_header.split(None, 1)
             assert (scheme == 'Basic')
             username, password = data.decode('base64').split(':', 1)
             self.user = self._get_user(username, password)
         except Exception, e:
             raise NotAuthorizedError(str(e))
Exemplo n.º 2
0
 def __init__(self):
     super(object, self).__init__()
     self.user = None
     if type(self.account_manager) == dict:
         self.account_manager = Bunch(**self.account_manager)
     request = pico.get_request()
     if 'HTTP_AUTHORIZATION' in request:
         try:
             auth_header = request.get('HTTP_AUTHORIZATION')
             scheme, data = auth_header.split(None, 1)
             assert(scheme == 'Basic')
             username, password = data.decode('base64').split(':', 1)
             self.user = self._get_user(username, password)
         except Exception, e:
             raise NotAuthorizedError(str(e))