

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# AWS CLI 的 AWS IAM Identity Center 概念
<a name="cli-configure-sso-concepts"></a>

本主題說明 AWS IAM Identity Center (IAM Identity Center) 的主要概念。IAM Identity Center 是一種雲端型 IAM 服務，透過與現有身分提供者 (IdP) 整合，簡化跨多個 AWS 帳戶、應用程式、SDK 和工具的使用者存取管理。它透過集中式使用者入口網站啟用安全的單一登入、許可管理和稽核，簡化組織的身分和存取控管。

**Topics**
+ [什麼是 IAM Identity Center](#cli-configure-sso-concepts-what)
+ [條款](#cli-configure-sso-terms)
+ [IAM Identity Center 的運作方式](#cli-configure-sso-concepts-process)
+ [其他資源](#cli-configure-sso-concepts-resources)

## 什麼是 IAM Identity Center
<a name="cli-configure-sso-concepts-what"></a>

IAM Identity Center 是一種雲端型身分和存取管理 (IAM) 服務，可讓您集中管理對多個 AWS 帳戶 和商業應用程式的存取。

它提供使用者入口網站，在此授權使用者可以使用其現有的公司憑證，來存取他們獲授予許可的 AWS 帳戶 和應用程式。這可讓組織強制執行一致的安全政策，並簡化使用者存取管理。

無論您使用哪種 IdP，IAM Identity Center 都會將這些區別擷取出來。例如，您可以按照部落格文章 [IAM Identity Center 的下一個演變](https://aws.amazon.com/blogs/aws/the-next-evolution-in-aws-single-sign-on/)中所述的方法連線 Microsoft Azure AD。

**注意**  
如需使用不需帳戶 ID 和角色之承載驗證的相關資訊，請參閱 *Amazon CodeCatalyst 使用者指南*中的[設定以將 AWS CLI 搭配 CodeCatalyst 使用](https://docs.aws.amazon.com/codecatalyst/latest/userguide/set-up-cli.html)。

## 條款
<a name="cli-configure-sso-terms"></a>

使用 IAM Identity Center 時的常用術語如下：

**身分提供者 (IdP)**  
身分管理系統，例如 IAM Identity Center、Microsoft Azure AD、Okta 或您自己的公司目錄服務。

**AWS IAM Identity Center**  
IAM Identity Center 是 AWS 擁有的 IdP 服務。SDK 以前稱為 AWS 單一登入，其與工具會保留 `sso` API 命名空間以確保回溯相容性。如需詳細資訊，請參閱《AWS IAM Identity Center 使用者指南》**中的 [IAM Identity Center 重新命名](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed)。

**AWS 存取入口網站 URL、SSO 啟動 URL、啟動 URL**  
您組織的唯一 IAM Identity Center URL，以存取授權的 AWS 帳戶、服務和資源。

**發行者 URL**  
您組織的唯一 IAM Identity Center 發行者 URL，以程式設計方式存取授權的 AWS 帳戶、服務和資源。從 AWS CLI 的 2.22.0 版開始，發行者 URL 可以與啟動 URL 交替使用。

**聯合**  
在 IAM Identity Center 與身分提供者之間建立信任的程序，以啟用單一登入 (SSO)。

**AWS 帳戶**  
您透過 AWS IAM Identity Center 為使用者提供其存取權的 AWS 帳戶。

**許可集、AWS 憑證、憑證、sigv4 憑證**  
可指派給使用者或群組以授予 AWS 服務 存取權的預先定義許可集合。

**註冊範圍、存取範圍、範圍**  
範圍是 OAuth 2.0 中的一種機制，用於限制應用程式對使用者帳戶的存取。應用程式可以請求一個或多個範圍，則核發給應用程式的存取權杖僅限於授予的範圍。如需範圍的相關資訊，請參閱《IAM Identity Center 使用者指南》**中的[存取範圍](https://docs.aws.amazon.com/singlesignon/latest/userguide/customermanagedapps-saml2-oauth2.html#oidc-concept)。

**權杖、重新整理權杖、存取權杖**  
權杖是在身分驗證時核發給您的臨時安全憑證。這些權杖包含有關您的身分和已授予您之許可的資訊。  
當您透過 IAM Identity Center 入口網站存取 AWS 資源或應用程式時，會向 AWS 呈現您的權杖以進行身分驗證和授權。這可讓 AWS 驗證您的身分，並確保您擁有執行所請求動作的必要許可。  
系統會根據工作階段名稱將身分驗證權杖快取至以 JSON 檔案名稱為名之 `~/.aws/sso/cache` 目錄下的磁碟。

**Session (工作階段)**  
IAM Identity Center 工作階段是指驗證使用者身分並授權使用者存取 AWS 資源或應用程式的一段時間。當使用者登入 IAM Identity Center 入口網站時，會建立工作階段，且使用者的權杖在指定的持續時間內有效。如需設定工作階段持續時間的詳細資訊，請參閱《AWS IAM Identity Center 使用者指南》**中的[設定工作階段持續時間](https://docs.aws.amazon.com/singlesignon/latest/userguide/howtosessionduration.html)。  
在工作階段期間，您可以在不同的 AWS 帳戶和應用程式之間瀏覽，無需重新驗證身分，只要其工作階段保持作用中狀態即可。當工作階段過期時，請再次登入以續約您的存取權。  
IAM Identity Center 工作階段有助於提供無縫使用者體驗，同時透過限制使用者存取憑證的有效性來強制執行安全最佳實務。

**使用 PKCE、PKCE、代碼交換證明金鑰授予的授權碼**  
自 2.22.0 版起，代碼交換證明金鑰 (PKCE) 是具有瀏覽器之裝置的 OAuth 2.0 身分驗證授予流程。PKCE 是一種簡單且安全的方式，可讓您透過 Web 瀏覽器來驗證身分和取得從桌面和行動裝置存取您 AWS 資源的同意。這是預設的授權行為。如需 PKCE 的詳細資訊，請參閱《AWS IAM Identity Center 使用者指南》**中的[使用 PKCE 授予授權碼](https://docs.aws.amazon.com/singlesignon/latest/userguide/customermanagedapps-saml2-oauth2.html#auth-code-grant-pkce)。

**裝置授權授予**  
具有或不具有 Web 瀏覽器之裝置的 OAuth 2.0 身分驗證授予流程。如需設定工作階段持續時間的詳細資訊，請參閱《AWS IAM Identity Center 使用者指南》**中的[裝置授權授予](https://docs.aws.amazon.com/singlesignon/latest/userguide/customermanagedapps-saml2-oauth2.html#device-auth-grant)。

## IAM Identity Center 的運作方式
<a name="cli-configure-sso-concepts-process"></a>

IAM Identity Center 會與您組織的身分提供者整合，例如 IAM Identity Center、Microsoft Azure AD 或 Okta。使用者對此身分提供者進行身分驗證，然後 IAM Identity Center 將這些身分映射到您 AWS 環境中的適當許可和存取權。

下列 IAM Identity Center 工作流程假設您已將 AWS CLI 設定為使用 IAM Identity Center：

1. 在您偏好的終端機中執行 `aws sso login` 命令。

1. 登入您的 AWS 存取入口網站 以啟動新的工作階段。
   + 當您啟動新的工作階段時，會收到重新整理權杖和已快取的存取權杖。
   + 如果您已經有作用中的工作階段，則現有的工作階段會重複使用，並在現有的工作階段過期時過期。

1. IAM Identity Center 會根據您在 `config` 檔案中設定的設定檔，取得適當的許可集，並授予相關 AWS 帳戶 和應用程式的存取權。

1. AWS CLI、SDK 和工具會使用您擔任的 IAM 角色來呼叫 AWS 服務，例如建立 Amazon S3 儲存貯體，直到該工作階段過期為止。

1. 每小時會檢查 IAM Identity Center 的存取權杖一次，並自動使用重新整理權杖重新整理。
   + 如果存取權杖已過期，SDK 或工具會使用重新整理權杖來取得新的存取權杖。然後會比較這些權杖的工作階段持續時間，如果重新整理權杖未過期，則 IAM Identity Center 會提供新的存取權杖。
   + 如果重新整理權杖已過期，則不會提供新的存取權杖，且您的工作階段已結束。

1. 工作階段會在重新整理權杖過期後結束，或在您使用 `aws sso logout` 命令手動登出時結束。快取的憑證會移除。若要繼續使用 IAM Identity Center 來存取服務，您必須使用 `aws sso login` 命令啟動新的工作階段。

## 其他資源
<a name="cli-configure-sso-concepts-resources"></a>

其他資源如下所示。
+ [使用 設定 IAM Identity Center 身分驗證 AWS CLI](cli-configure-sso.md)
+ [教學課程：使用 IAM Identity Center 在 中執行 Amazon S3 命令 AWS CLI](cli-configure-sso-tutorial.md)
+ [安裝或更新至最新版本的 AWS CLI](getting-started-install.md)
+ [中的組態和登入資料檔案設定 AWS CLI](cli-configure-files.md)
+ 《AWS CLI 第 2 版參考》**中的 [https://docs.aws.amazon.com/cli/latest/reference/configure/sso.html](https://docs.aws.amazon.com/cli/latest/reference/configure/sso.html)
+ 《AWS CLI 第 2 版參考》**中的 [https://docs.aws.amazon.com/cli/latest/reference/configure/sso-session.html](https://docs.aws.amazon.com/cli/latest/reference/configure/sso-session.html)
+ 《AWS CLI 第 2 版參考》**中的 [https://docs.aws.amazon.com/cli/latest/reference/sso/login.html](https://docs.aws.amazon.com/cli/latest/reference/sso/login.html)
+ 《AWS CLI 第 2 版參考》**中的 [https://docs.aws.amazon.com/cli/latest/reference/sso/logout.html](https://docs.aws.amazon.com/cli/latest/reference/sso/logout.html)
+ 《Amazon CodeCatalyst 使用者指南》**中的[設定以將 AWS CLI 搭配 CodeCatalyst 使用](https://docs.aws.amazon.com/codecatalyst/latest/userguide/set-up-cli.html)
+ 《AWS IAM Identity Center 使用者指南》**中的 [IAM Identity Center 重新命名](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed)
+ *IAM Identity Center 使用者指南*中的 [OAuth 2.0 存取範圍](https://docs.aws.amazon.com/singlesignon/latest/userguide/customermanagedapps-saml2-oauth2.html#oidc-concept)
+ 《AWS IAM Identity Center 使用者指南》**中的[設定工作階段持續時間](https://docs.aws.amazon.com/singlesignon/latest/userguide/howtosessionduration.html)
+ 《IAM Identity Center 使用者指南》**中的[入門教學課程](https://docs.aws.amazon.com/singlesignon/latest/userguide/tutorials.html)