def post(self):
    """POST"""
    ca_id = self.request.get('ca_id', None)
    auth1 = self.GetAuth1Instance(ca_id=ca_id)

    if self._IsRemoteIpAddressBlocked(os.environ.get('REMOTE_ADDR', '')):
      raise base.NotAuthenticated('RemoteIpAddressBlocked')

    n = self.request.get('n', None)
    m = self.request.get('m', None)
    s = self.request.get('s', None)

    # uncomment for verbose logging on input auth sesssions
    #logging.debug('Input n=%s m=%s s=%s', n, m, s)

    try:
      auth1.Input(n=n, m=m, s=s)
    except __HOLE__, e:
      logging.exception('invalid parameters to auth1.Input()')
      raise base.NotAuthenticated('InvalidAuth1InputParams')

    output = auth1.Output()
    auth_state = auth1.AuthState()

    if auth_state == gaeserver.base.AuthState.OK:
      if output:
        self.response.headers['Set-Cookie'] = '%s=%s; secure; httponly;' % (
            auth.AUTH_TOKEN_COOKIE, output)
        self.response.out.write(auth.AUTH_TOKEN_COOKIE)
      else:
        logging.critical('Auth is OK but there is no output.')
        raise base.NotAuthenticated('AuthOkOutputEmpty')
    elif auth_state == gaeserver.base.AuthState.FAIL:
      raise base.NotAuthenticated('AuthStateFail')
    elif output:
      self.response.out.write(output)
    else:
      logging.critical('auth_state is %s but no output.', auth_state)
      # technically 500, 403 for security
      raise base.NotAuthenticated('AuthStateUnknownOutputEmpty')
dataset/ETHPy150Open google/simian/src/simian/mac/munki/handlers/auth.py/Auth.post