def get(self): user = self.request.user gwsUser = GWS_User.get(user.username) keys = GWS_AccessKey.select("user",user.username) s = "You have %d access key(s):<br>"%len(keys) for k in keys: s+=k.key_name+"<br>" return self.write({"full_name":user.get_full_name(),"dump":s})
def auth_key(self, request): if 'HTTP_AUTHORIZATION' in request.META: auth = request.META['HTTP_AUTHORIZATION'].split() if len(auth) == 2 and auth[0] == 'GeoDaWS': AccessKeyID,signature = auth[1].split(':') accesskey = GWS_AccessKey.get(AccessKeyID) if accesskey and accesskey.calc_signature(request) == signature: return accesskey.User else: return None