> For the complete documentation index, see [llms.txt](https://docs.coreway.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coreway.com/coreway-hr/zh-hk/sso/google-workspace.md).

# 附錄：Google Workspace 設定範例

Google Workspace 可以作為 SAML 2.0 的身份提供者（IdP）。整體流程與 [第二步](/coreway-hr/zh-hk/sso/register.md)、[第三步](/coreway-hr/zh-hk/sso/idp-config.md) 相同，本頁只列出 Google 管理控制台的對應位置與注意事項。

操作位置：[Google 管理控制台](https://admin.google.com/)，需具備**超級管理員**權限。

{% hint style="info" %}
開始前請先完成 [第一步：設定組織代碼](/coreway-hr/zh-hk/sso/login-code.md)，並從「登記到企業身份源」區塊複製所需地址。
{% endhint %}

## 與其他身份源的三個差異

1. **不支援匯入**：Google 只提供中繼資料 XML 的**下載**，沒有可直接存取的 https 中繼資料網址，因此本系統的「匯入」用不上，三個關鍵參數需手動填寫。
2. **不支援統一登出**：Google Workspace 的自訂 SAML 應用程式沒有 SLO 端點，請把「登出時同時退出企業身份源」**保持關閉**。
3. **設定有生效延遲**：使用者存取權的變更通常幾分鐘內生效，但最長可能需要 24 小時，測試失敗時先確認是不是還沒生效。

## A. 在 Google 管理控制台建立 SAML 應用程式

{% stepper %}
{% step %}

### 新增自訂 SAML 應用程式

前往 **應用程式 → 網頁應用程式和行動應用程式**。

點 **新增應用程式 → 新增自訂 SAML 應用程式**。

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2FsXpcaTK5iiJiGDpkVvPt%2Fimage.png?alt=media&amp;token=df5c2096-5913-49ef-a9c6-a778825253be" alt=""><figcaption></figcaption></figure>

填寫應用程式名稱（例如 `YOOV`），可上傳圖示，點 **繼續**。

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2F8GE5oSd1EEr8JcLtyL6R%2Fimage.png?alt=media&amp;token=0ae8a320-86bb-43a4-a679-c878dc2c202d" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 複製 Google 的身份提供者資訊（重要）

在「Google 識別資訊提供者詳細資料」頁面，選 **方法 2：複製單一登入網址、實體 ID 和憑證**，把三項都保存下來：

| Google 提供的 | 對應本系統的欄位  |
| ---------- | --------- |
| SSO 網址     | 單一登入地址    |
| 實體 ID      | Entity ID |
| 憑證         | 簽章憑證      |

{% hint style="info" %}
這一頁離開後還可以在應用程式詳情裡重新查看，但建議當下就複製好。憑證也可以點「下載」取得 `.pem` 檔，用文字編輯器打開複製內容。
{% endhint %}
{% endstep %}

{% step %}

### 填寫服務供應商詳細資料

在「服務供應商詳細資料」頁面按下表填寫：

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2FugW5nWq3j1YqAWl3MBpw%2Fimage.png?alt=media&amp;token=184b307d-5f69-440f-952b-0cdca66b21f2" alt=""><figcaption></figcaption></figure>

| Google 欄位 | 填入本系統的        |
| --------- | ------------- |
| ACS 網址    | 斷言消費地址（ACS）   |
| 實體 ID     | SP Entity ID  |
| 已簽署的回應    | 建議勾選          |
| 名稱 ID 格式  | `EMAIL`       |
| 名稱 ID     | 基本資訊 → 主要電子郵件 |

點 **繼續**。
{% endstep %}

{% step %}

### 屬性對應（選用）

若打算用 NameID 配對（建議做法），這一步可以直接略過——A3 已把名稱 ID 設為主要電子郵件。

若要改用屬性配對，點 **新增對應**，例如把 **基本資訊 → 主要電子郵件** 對應到屬性名稱 `email`，之後在本系統的「配對值來源」選「斷言中的屬性」、「屬性名稱」填 `email`。

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2FKtluJTVPGHx97d28wtjD%2Fimage.png?alt=media&amp;token=f0e4c788-a33b-4513-984f-e9c0bc07765f" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
屬性名稱請全部使用小寫，大小寫不一致會導致配對不到。
{% endhint %}

點 **完成**。
{% endstep %}

{% step %}

### 開啟使用者存取權（最容易漏掉的一步）

回到 **網頁應用程式和行動應用程式**，點開剛建立的應用程式。

點 **使用者存取權** 卡片。

選擇對**所有人**開啟，或針對特定機構單位／群組開啟，點 **儲存**。

新建立的 SAML 應用程式預設是**關閉**的，沒開這一步，成員登入時會在 Google 端被擋下。

{% hint style="info" %}
設定通常幾分鐘內生效，最長可能需要 24 小時。
{% endhint %}
{% endstep %}
{% endstepper %}

## B. 回到本系統完成設定

{% stepper %}
{% step %}

### 選擇企業身份源設定

前往 **安全 → 企業登入 → 企業身份源**，協定選 **SAML 2.0**。

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2FA1qLQ5CX9USHNQCv7usM%2Fimage.png?alt=media&amp;token=00dfad9a-1446-40c6-93d4-0c3ce3d12d54" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 手動填寫身份提供者資訊

「IdP 中繼資料地址」**留空**（Google 沒有可用的中繼資料網址），直接手動填寫下方欄位：

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2F9VntZEgW74IgYXtKlXkt%2Fimage.png?alt=media&amp;token=41b872a9-b9b9-43c8-804c-441ac12e51aa" alt=""><figcaption></figcaption></figure>

| 本系統欄位         | 填入                                                                 |
| ------------- | ------------------------------------------------------------------ |
| Entity ID     | A2 複製的「實體 ID」，格式類似 `https://accounts.google.com/o/saml2?idpid=...` |
| 單一登入地址        | A2 複製的「SSO 網址」                                                     |
| 單一登出地址        | **留空**（Google 不支援）                                                 |
| NameID 格式     | `emailAddress`                                                     |
| 簽章憑證          | A2 複製的憑證內容                                                         |
| 配對值來源         | `NameID`（若依 A4 改用屬性，則選「斷言中的屬性」並填屬性名稱）                              |
| 對登入請求簽章       | 關閉                                                                 |
| {% endstep %} |                                                                    |

{% step %}

### 關閉企業身份源同步登出

確認「登出時同時退出企業身份源」為**關閉**。

<figure><img src="https://1973974622-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBZneYuSUsErYNDcsI8Fx%2Fuploads%2F4RBxH7CohnlJIyCv6ICh%2Fimage.png?alt=media&amp;token=c0951d64-db23-458c-afb1-dfb5d0fdf384" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 儲存設定

點 **儲存**。

{% hint style="info" %}
貼憑證時只需要 `BEGIN CERTIFICATE` 與 `END CERTIFICATE` 之間的內容，前後兩行標記可留可不留，但不要夾帶多餘空白行。
{% endhint %}
{% endstep %}
{% endstepper %}

## C. Google Workspace 常見問題

<details>

<summary>Google 顯示無權存取此應用程式</summary>

A5 的使用者存取權沒開，或該成員所屬機構單位沒被涵蓋。

</details>

<details>

<summary>剛改完設定仍然登入失敗</summary>

Google 端設定尚未生效，最長需等 24 小時。

</details>

<details>

<summary>憑證貼上後儲存失敗</summary>

內容夾帶了多餘空白或換行，重新複製一次。

</details>

<details>

<summary>登入成功但系統提示配對失敗</summary>

Google 回傳的主要電子郵件與成員的電郵不一致，到 [第四步](broken://pages/a0515f72ffd0c014dfecdcdd717526d1ef933a67) 單獨設定成員企業帳號。

</details>

<details>

<summary>想使用統一登出</summary>

Google Workspace 不支援 SAML SLO，此功能請保持關閉。

</details>

<details>

<summary>憑證即將到期</summary>

在 Google 應用程式詳情頁重新產生憑證後，回本系統更新「簽章憑證」。

</details>

其餘問題請見 [常見問題](/coreway-hr/zh-hk/sso/faq.md)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coreway.com/coreway-hr/zh-hk/sso/google-workspace.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
