---
schema_version: "1"
id: 8b9e31492868e2d988a338bc7a1955e8d5877be444cf18b84bab0c1f88f691fb
title: 测试受信任的身份验证
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server/trusted_auth_testing.md
canonical_url: https://help.tableau.com/current/server/zh-cn/trusted_auth_testing.htm
source_site: help.tableau.com
content_type: documentation
content_hash: db5aad868f84da1829810c4f7df8a03e37ebb9d541d5662bd20c82ac1b988cef
description: Test trusted authentication configuration on Tableau Server.
---
[跳转到主要内容](#main-content)

# 测试受信任的身份验证

下面的步骤提供了一种方法，用于测试从 Web 服务器中检索受信任票证的操作。这项简单的测试可以帮助评估 Web 服务器和 Tableau Server 之间的连接，以及是否正确配置了受信任的身份验证。

**重要信息**：本主题中提供的测试代码在浏览器中运行客户端，以提供快速的可视化验证，证明在 Tableau Server 上正确配置了受信任的身份验证。如果加载 html 页的客户端浏览器不在受信任的 Web 服务器上，则可能需要暂时信任客户端 IP。实际上，您绝不应在受信任的身份验证配置过程中信任客户端 IP 地址。所有受信任的 IP 地址都能够以任何用户（包括管理员）身份请求票证。在生产环境中，所有受信任的身份验证流程都应仅在 Tableau Server 和受信任的 Web 服务器之间运行服务器端。

由于测试在客户端浏览器上运行，因此测试不是生产环境中通信路径的精确副本。成功运行测试后，我们建议您随后使用服务器端 post 请求为用户测试请求票证，以便进行最终验证。

一种替代测试方法是运行受信任的票证生成器来测试您的配置。以下 URL 引用 Tableau 不支持的受信任票证生成器。但是，许多客户都使用生成器来测试其受信任的票证配置：[https://github.com/mkannan-tsi/Trusted-Ticket-Generator](https://github.com/mkannan-tsi/Trusted-Ticket-Generator)。

## 步骤 1：添加测试用户

在 Tableau Server 上创建一个可用于测试受信任票证功能的用户。请参见[将用户添加到 Tableau Server](https://help.tableau.com/current/server/zh-cn/users_add.htm)。将该用户添加到服务器上的站点。

## 步骤 2：创建一个测试 HTML 页面

将以下代码粘贴到您保存在从中执行测试的 Tableau Server 计算机上的一个新 .html 文件中。您可以根据喜好更改标签和样式属性。

<html>
<head>
<title>Trusted Ticket Requester</title>
<script type="text/javascript">
  function submitForm(){
    document.getElementById('form1').action =
    document.getElementById('server').value + "/trusted";
  }
</script>
<style type="text/css">
  .style1 {width: 100%;}
  .style2 {width: 429px;}
  #server {width: 254px;}
</style>
</head>
<body>
<h3>Trusted Ticketer</h3>
<form method="POST" id="form1" onSubmit="submitForm()">
  <table class="style1">
    <tr>
      <td class="style2">Username</td>
      <td><input type="text" name="username" value="" /></td>
    </tr>
    <tr>
      <td class="style2">Server</td>
      <td><input type="text" id="server" name="server" value="https://" /></td>
    </tr>
    <tr>
      <td class="style2">Client IP (optional)</td>
      <td><input type="text" id="client\_ip" name="client\_ip" value="" /></td>
    </tr>
    <tr>
      <td class="style2">Site (leave blank for Default site; otherwise enter the site name)</td>
      <td><input type="text" id="target\_site" name="target\_site" value="" /></td>
    </tr>
    <tr>
      <td class="style2"><input type="submit" name="submittable" value="Get Ticket" /></td>
      <td>&#160;</td>
    </tr>
  </table>
</form>
<h4>Be sure to add your IP as a Trusted IP address to the server</h4>
</body>
</html>

## 步骤 3：从 Tableau Server 检索受信任票证

以下过程将从 Tableau Server 返回受信任票证。

1. 打开您在上一步中创建的网页。
    
    ![通过提供用户名、服务器以及（可选）客户端 IP 和站点来获取安全票证的表单。](/tableau/current/zh-cn/server/zh-cn/Img/trusted_auth_test.png)
    
    此操作需要 Javascript，因此 Web 浏览器可能会提示您允许脚本运行。
2. 在文本框中，输入以下内容：
    
    - **用户名**：在步骤 1 中创建的测试用户。
    - **Server（服务器）**：Tableau Server 的地址，例如，`https://<server_name>`。
    - **客户端 IP（可选）**：用户计算机的 IP 地址（如果为客户端受信任 IP 匹配配置了 IP 地址）。
    - **站点**：测试用户所属 Tableau Server 站点的名称。
3. 单击“**获取票证**”。将返回以下各项之一：
    
    - **唯一的票证**：受信任票证是一个由 base64 编码 UUID 和 24 字符随机字符串组成的字符串，例如，`9D1OlxmDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5`。
    - **\-1**：如果返回了值 `-1`，则配置包含错误。请参见[从 Tableau Server 返回了票证值 -1](https://help.tableau.com/current/server/zh-cn/trusted_auth_trouble_1return.htm)。

## 步骤 4：使用受信任票证测试访问

既然有了票证，您就可以使用它来访问 Tableau Server 上的内容。

使用您在上一步中创建的唯一票证来构造 URL，从而使用受信任票证来验证访问。如果使用单一站点（而不是托管多个站点的服务器）访问 Tableau Server，则 URL 语法不同。

**默认站点服务器 URL**

`https://<server_name>/trusted/<unique_ticket>/views/<workbook_name>/<view_name>`

**非默认站点服务器 URL**

`https://<server_name>/trusted/<unique_ticket>/t/<site_name>/views/<workbook_name>/<view_name>`

URL 中的变量由尖括号（`<` 和 `>`）指明。所有其他语法为文本。