'Check if a given token has valid permissions and return them.'

def ValidateAuthTokenClient(self, token):

    if (not self.client_creds):
        return None
    if (not self.GetNonce(token.nonce)):
        return None
    if (not self.client_creds.HasUser(token.username)):
        return None
    password = self.client_creds.GetPassword(token.username)
    generated_hash = self._GenerateAuthHash(token.nonce, token.username, password)
    if (token.hash != generated_hash):
        return None
    return self.client_creds.GetPermissions(token.username)
