---
schema_version: "1"
id: 52ebdbdcaec8a2509afb2083a98c0067b157832ef59bfb4858de5056ef44f16f
title: 測試受信任的驗證
collection: tableau
version: current
locale: zh-tw
portal_url: https://docs.salesforce.com/tableau/current/zh-tw/server/trusted_auth_testing.md
canonical_url: https://help.tableau.com/current/server/zh-tw/trusted_auth_testing.htm
source_site: help.tableau.com
content_type: documentation
content_hash: e369287bdfd41a2c371968e6cb053ac0474b95db61a11f370e84d2ed2ded1fc6
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-tw/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-tw/server/zh-tw/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-tw/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 中的變數由尖括弧（`<` 和 `>`）指明。所有其他語法為文字。