Esempio n. 1
0
def create_logout_url(dest_url, _auth_domain=None):
    """Computes the logout URL for this request and specified destination URL,
     for both federated login App and Google Accounts App.

  Args:
    dest_url: String that is the desired final destination URL for the user
              once logout is complete. If 'dest_url' does not have a host
              specified, we will use the host from the current request.

  Returns:
    Logout URL as a string
  """
    req = user_service_pb.CreateLogoutURLRequest()
    resp = user_service_pb.CreateLogoutURLResponse()
    req.set_destination_url(dest_url)
    if _auth_domain:
        req.set_auth_domain(_auth_domain)

    try:
        apiproxy_stub_map.MakeSyncCall('user', 'CreateLogoutURL', req, resp)
    except apiproxy_errors.ApplicationError, e:
        if (e.application_error ==
                user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
            raise RedirectTooLongError
        else:
            raise e
Esempio n. 2
0
def create_logout_url(dest_url, _auth_domain=None):
  """Computes the logout URL and specified destination URL for the request.

  This function works for both federated login applications and Google Accounts
  applications.

  Args:
    dest_url: String that is the desired final destination URL for the user
        after the user has logged out. If `dest_url` does not specify a host,
        the host from the current request is used.

  Returns:
    Logout URL as a string.
  """
  req = user_service_pb.CreateLogoutURLRequest()
  resp = user_service_pb.CreateLogoutURLResponse()
  req.set_destination_url(dest_url)
  if _auth_domain:
    req.set_auth_domain(_auth_domain)

  try:
    apiproxy_stub_map.MakeSyncCall('user', 'CreateLogoutURL', req, resp)
  except apiproxy_errors.ApplicationError, e:
    if (e.application_error ==
        user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
      raise RedirectTooLongError
    else:
      raise e