

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

# 什麼是 Amazon Cognito？
<a name="what-is-amazon-cognito"></a>

Amazon Cognito 是適用於 Web 和行動應用程式的身分平台。是一種使用者目錄、身分驗證伺服器，以及 OAuth 2.0 存取權杖和 AWS 憑證的授權服務。使用 Amazon Cognito，您可以從內建的使用者目錄、企業目錄以及 Google 和 Facebook 等消費者身分提供者進行驗證和授權使用者。

**Topics**
+ [使用者集區](#what-is-amazon-cognito-user-pools)
+ [身分集區](#what-is-amazon-cognito-identity-pools)
+ [Amazon Cognito 功能](#what-is-amazon-cognito-features)
+ [Amazon Cognito 使用者集區和身分池比較](#what-is-amazon-cognito-features-comparison)
+ [Amazon Cognito 入門](#getting-started-overview)
+ [區域可用性](#getting-started-regional-availability)
+ [Amazon Cognito 定價](#pricing-for-amazon-cognito)
+ [常見 Amazon Cognito 術語和概念](cognito-terms.md)
+ [入門 AWS](cognito-getting-started-account-iam.md)

接下來兩個元件組成 Amazon Cognito。兩個元件會根據您對使用者的存取需求獨立或一併運作。

## 使用者集區
<a name="what-is-amazon-cognito-user-pools"></a>

![\[Amazon Cognito user pool authentication flow with app, identity provider, and API/Database.\]](http://docs.aws.amazon.com/zh_tw/cognito/latest/developerguide/images/user-pools-overview.png)


當您要對應用程式或 API 進行驗證和使用者授權時，請建立使用者集區。使用者集區是具有自助服務和管理員驅動的使用者建立、管理和驗證的使用者目錄。您的使用者集區可以是獨立的目錄和 OIDC 身分提供者 (IdP)，也可以是第三方員工和客戶身分提供者的中繼服務提供者 (SP)。針對您組織在具使用者集區之 SAML 2.0 與 OIDC IdPs 中的人力身份，您可以在應用程式提供單一登入 (SSO)。針對您組織在公開 OAuth 2.0 身分儲存 Amazon、Google、Apple 和 Facebook 中的客戶身分，您也可以在應用程式提供 SSO。如需客戶身份與存取管理 (CIAM) 的更多資訊，請參閱 [CIAM 是什麼？](https://aws.amazon.com/what-is/ciam/)。

使用者集區不需要與身分池整合。在使用者集區中，您可以將經過驗證的 JSON Web 權杖 (JWT) 直接發布至應用程式、Web 伺服器或 API。

## 身分集區
<a name="what-is-amazon-cognito-identity-pools"></a>

![\[Diagram showing Amazon Cognito federated identities flow between app, identity pool, provider, and STS.\]](http://docs.aws.amazon.com/zh_tw/cognito/latest/developerguide/images/identity-pools-overview.png)


當您想要授權已驗證或匿名的使用者存取您的 AWS 資源時，請設定 Amazon Cognito 身分集區。身分集區會為您的應用程式發出 AWS 憑證，以為使用者提供資源。您可以使用受信任的身分提供者 (例如，使用者集區或 SAML 2.0 服務) 來驗證使用者。也可以選擇性地為訪客使用者發布憑證。身分集區同時使用角色型和屬性型存取控制，來管理使用者存取 AWS 資源的授權。

身分池不需要與使用者集區整合。身分池可以直接從員工和消費者身分提供者接受經過驗證的宣告。

**一併使用的 Amazon Cognito 使用者集區與身分池**

在本主題開始的圖表中，您可以使用 Amazon Cognito 驗證您的使用者，然後授與他們存取 AWS 服務。

1. 您的應用程式使用者會透過使用者集區登入，並收到 OAuth 2.0 權杖。

1. 您的應用程式會與身分集區交換使用者集區字符，以取得您可以搭配 AWS APIs和 AWS Command Line Interface () 使用的臨時 AWS 登入資料AWS CLI。

1. 您的應用程式會將登入資料工作階段指派給您的使用者，並提供授權存取給 ， AWS 服務 例如 Amazon S3 和 Amazon DynamoDB。

如需使用身分池和使用者集區的更多範例，請參閱 [Amazon Cognito 常見案例](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-scenarios.html)。

Amazon Cognito，[共同責任模型](https://aws.amazon.com/compliance/shared-responsibility-model/)的雲端安全性義務符合 SOC 1-3、PCI DSS、ISO 27001，並具有 HIPAA-BAA 資格。您可以在 Amazon Cognito 設計雲端安全性，以符合 SOC1-3、27001、HIPAA-BAA 規範，但不具有 PCI DSS。如需詳細資訊，請參閱 [AWS 服務範圍](https://aws.amazon.com/compliance/services-in-scope/)。請同時參閱[區域資料考量](https://docs.aws.amazon.com/cognito/latest/developerguide/security-cognito-regional-data-considerations.html)。

## Amazon Cognito 功能
<a name="what-is-amazon-cognito-features"></a>

### 使用者集區
<a name="what-is-amazon-cognito-features-user-pools"></a>

Amazon Cognito 使用者集區是一種使用者目錄。透過使用者集區，您的使用者就可以透過 Amazon Cognito 登入 Web 或行動應用程式，或者透過第三方 IdP 以聯合身分登入。聯合和本機使用者在使用者集區中有一個使用者設定檔。

本機使用者是直接在使用者集區中註冊或建立的使用者。您可以在 AWS 管理主控台、 AWS 開發套件或 AWS Command Line Interface () 中管理和自訂這些使用者設定檔AWS CLI。

Amazon Cognito 使用者集區接受來自第三方 IdP 的權杖和宣告，並收集使用者屬性到發布至應用程式的 JWT 中。您可以在一組 JWT 上標準化應用程式，而 Amazon Cognito 會處理與 IdPs 的互動，將其宣告映射至中央權杖格式。

Amazon Cognito 使用者集區可以是獨立的 IdP。Amazon Cognito 從 OpenID Connect (OIDC) 標準中提取，產生用於身分驗證和授權的 JWT。當您登入本機使用者時，您的使用者集區對這些使用者具有權威性。當您驗證本機使用者時，可以存取下列功能。
+ 實作自己的網頁前端，該前端會呼叫 Amazon Cognito 使用者集區 API 來驗證、授權和管理您的使用者。
+ 為使用者設定多重要素驗證 (MFA) Amazon Cognito 支援以時間為基礎的一次性密碼 (TOTP) 和 SMS 訊息 MFA。
+ 防止受到惡意控制的使用者帳戶存取。
+ 建立您自己的自訂多步驟身份驗證流程。
+ 查詢其他目錄中的使用者，然後將其遷移到 Amazon Cognito。

Amazon Cognito 使用者集區也可以扮演雙重角色，既是 IdP 服務提供者 (SP) 也是應用程式執行 IdP。Amazon Cognito 使用者集區可以連接至消費者 IdP，如 Facebook 和 Google，或是生產力 IdP，如 Okta 和 Active Directory 同盟服務 (ADFS)。

使用 Amazon Cognito 使用者集區發布的 OAuth 2.0 和 OpenID Connect (OIDC) 權杖，您可以
+ 在您的應用程式中接受對使用者進行身分驗證的 ID 權杖，並提供設定使用者設定檔所需的資訊
+ 在您的 API 中接受具有授權使用者 API 呼叫 OIDC 範圍的存取權杖。
+ 從 Amazon Cognito 身分集區擷取 AWS 憑證。


| 
| 
| 功能 | Description | 
| --- |--- |
| OIDC identity provider | Issue ID tokens to authenticate users | 
| Authorization server | Issue access tokens to authorize user access to APIs | 
| SAML 2.0 service provider | Transform SAML assertions into ID and access tokens | 
| OIDC relying party | Transform OIDC tokens into ID and access tokens | 
| Social provider relying party | Transform ID tokens from Apple, Facebook, Amazon, or Google to your own ID and access tokens | 
| Authentication frontend service | Sign up, manage, and authenticate users with managed login | 
| API support for your own UI | Create, manage and authenticate users through authentication API requests in supported AWS SDKs¹ | 
| Multi-factor authentication | Use SMS messages, TOTPs, or your user's device as an additional authentication factor¹ | 
| Security monitoring & response | Secure against malicious activity and insecure passwords¹ | 
| Customize authentication flows | Build your own authentication mechanism, or add custom steps to existing flows² | 
| Groups | Create logical groupings of users, and a hierarchy of IAM role claims when you pass tokens to identity pools | 
| Customize tokens | Customize your ID and access tokens with new, modified, and suppressed claims | 
| Customize user attributes | Assign values to user attributes and add your own custom attributes | 

1 聯合身分使用者無法使用 功能。

2 聯合身分和受管登入使用者無法使用 功能。

如需使用者集區的詳細資訊，請參閱 [使用者集區入門](getting-started-user-pools.md) 和 [Amazon Cognito 使用者集區 API 參考](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/)。

### 身分集區
<a name="what-is-amazon-cognito-features-identity-pools"></a>

身分集區是您指派給使用者或訪客的唯一識別符或身分集合，並授權 接收臨時 AWS 登入資料。當您以來自 SAML 2.0、OpenID Connect (OIDC) 或 OAuth 2.0 社交身分提供者 (IdP) 的受信任宣告形式向身分池提供驗證時，表示您將您的使用者與身分池中的身分建立關聯。身分集區為身分建立的字符可以從 AWS Security Token Service () 擷取臨時工作階段憑證AWS STS。

若要補充已驗證的身分，您也可以設定身分集區以在沒有 IdP 身分驗證的情況下授權 AWS 存取。您可以使用 提供自訂身分驗證證明[開發人員驗證的身分](developer-authenticated-identities.md)。您也可以使用[未經驗證的身分](identity-pools.md#authenticated-and-unauthenticated-identities)，將臨時 AWS 登入資料授予訪客使用者。

使用身分集區時，您有兩種方式可與 中的 IAM 政策整合 AWS 帳戶。您可以一起使用或單獨使用這兩項功能。

**角色類型存取控制**  
當您的使用者將宣告傳遞至您的身分池時，Amazon Cognito 會選擇其請求的 IAM 角色。若要根據您的需求自訂角色許可，請將 IAM 政策套用至每個角色。例如，如果您的使用者證明他們位於行銷部門，則他們會收到角色憑證，其中包含針對行銷部門存取需求而量身打造的原則。Amazon Cognito 可以請求預設角色、根據查詢使用者宣告的規則來請求角色，或根據使用者集區中使用者群組成員資格請求角色。您也可以設定角色信任政策，讓 IAM 僅信任您的身分池來產生臨時工作階段。

**存取控制的屬性**  
您的身分池會從使用者的宣告中讀取屬性，並將其映射至使用者臨時工作階段中的主要標籤。然後，您可以設定以 IAM 資源為基礎的政策，以從身分池中具有工作階段標籤的 IAM 主體允許或拒絕存取資源。例如，如果您的使用者證明他們位於行銷部門， 會 AWS STS 標記他們的工作階段 `Department: marketing`。您的 Amazon S3 儲存貯體將根據 [aws:PrincipalTag](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltag) 條件允許讀取操作，該條件需要的 `Department` 標籤值為 `marketing`。


| 
| 
| 功能 | Description | 
| --- |--- |
| Amazon Cognito user pool relying party | Exchange an ID token from your user pool for web identity credentials from AWS STS | 
| SAML 2.0 service provider | Exchange SAML assertions for web identity credentials from AWS STS | 
| OIDC relying party | Exchange OIDC tokens for web identity credentials from AWS STS | 
| Social provider relying party | Exchange OAuth tokens from Amazon, Facebook, Google, Apple, and Twitter for web identity credentials from AWS STS | 
| Custom relying party | With AWS credentials, exchange claims in any format for web identity credentials from AWS STS | 
| Unauthenticated access | Issue limited-access web identity credentials from AWS STS without authentication | 
| Role-based access control | Choose an IAM role for your authenticated user based on their claims, and configure your roles to only be assumed in the context of your identity pool | 
| Attribute-based access control | Convert claims into principal tags for your AWS STS temporary session, and use IAM policies to filter resource access based on principal tags | 

如需身分集區的詳細資訊，請參閱 [Amazon Cognito 身分集區入門](getting-started-with-identity-pools.md) 和 [Amazon Cognito 身分集區 API 參考](https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/)。



## Amazon Cognito 使用者集區和身分池比較
<a name="what-is-amazon-cognito-features-comparison"></a>


| 
| 
| 功能 | Description | 使用者集區 | 身分集區 | 
| --- |--- |--- |--- |
| OIDC identity provider | Issue OIDC ID tokens to authenticate app users | ✓ |  | 
| User directory | Store user profiles for authentication | ✓ |  | 
| Authorize API access | Issue access tokens to authorize user access to APIs (including user profile self-service API operations), databases, and other resources that accept OAuth scopes | ✓ |  | 
| IAM web identity authorization | Generate tokens that you can exchange with AWS STS for temporary AWS credentials |  | ✓ | 
| SAML 2.0 service provider & OIDC identity provider | Issue customized OIDC tokens based on claims from a SAML 2.0 identity provider | ✓ |  | 
| OIDC relying party & OIDC identity provider | Issue customized OIDC tokens based on claims from an OIDC identity provider | ✓ |  | 
| OAuth 2.0 relying party & OIDC identity provider | Issue customized OIDC tokens based on scopes from OAuth 2.0 social providers like Apple and Google | ✓ |  | 
| SAML 2.0 service provider & credentials broker | Issue temporary AWS credentials based on claims from a SAML 2.0 identity provider |  | ✓ | 
| OIDC relying party & credentials broker | Issue temporary AWS credentials based on claims from an OIDC identity provider |  | ✓ | 
| Social provider relying party & credentials broker | Issue temporary AWS credentials based on JSON web tokens from developer applications with social providers like Apple and Google |  | ✓ | 
| Amazon Cognito user pool relying party & credentials broker | Issue temporary AWS credentials based on JSON web tokens from Amazon Cognito user pools |  | ✓ | 
| Custom relying party & credentials broker | Issue temporary AWS credentials to arbitrary identities, authorized by developer IAM credentials |  | ✓ | 
| Authentication frontend service | Sign up, manage, and authenticate users with managed login | ✓ |  | 
| API support for your own authentication UI | Create, manage and authenticate users through API requests in supported AWS SDKs¹ | ✓ |  | 
| MFA | Use SMS messages, TOTPs, or your user's device as an additional authentication factor¹ | ✓ |  | 
| Security monitoring & response | Protect against malicious activity and insecure passwords¹ | ✓ |  | 
| Customize authentication flows | Build your own authentication mechanism, or add custom steps to existing flows¹ | ✓ |  | 
| User groups | Create logical groupings of users, and a hierarchy of IAM role claims when you pass tokens to identity pools | ✓ |  | 
| Customize tokens | Customize your ID and access tokens with new, modified, and suppressed claims and scopes | ✓ |  | 
| AWS WAF web ACLs | Monitor and control requests to your authentication front end with AWS WAF | ✓ |  | 
| Customize user attributes | Assign values to user attributes and add your own custom attributes | ✓ |  | 
| Unauthenticated access | Issue limited-access web identity credentials from AWS STS without authentication |  | ✓ | 
| Role-based access control | Choose an IAM role for your authenticated user based on their claims, and configure your role trust to limit access to web identity users |  | ✓ | 
| Attribute-based access control | Transform user claims into principal tags for your AWS STS temporary session, and use IAM policies to filter resource access based on principal tags |  | ✓ | 

1 功能不適用於聯合身分使用者。

## Amazon Cognito 入門
<a name="getting-started-overview"></a>

如需使用者集區應用程式的範例，請參閱 [使用者集區入門](getting-started-user-pools.md)。

如需身分集區的簡介，請參閱 [Amazon Cognito 身分集區入門](getting-started-with-identity-pools.md)。

如需使用者集區和身分集區之引導式設定體驗的連結，請參閱 [Amazon Cognito 的引導設定選項](cognito-guided-setup.md)。

若要開始使用 AWS SDK，請參閱[AWS 開發人員工具](https://aws.amazon.com/products/developer-tools)。如需 Amazon Cognito 特定的開發人員資源，請參閱 [Amazon Cognito 開發人員資源](https://aws.amazon.com/cognito/dev-resources/)。

若要使用 Amazon Cognito，您需要一個 AWS 帳戶。如需詳細資訊，請參閱[入門 AWS](cognito-getting-started-account-iam.md)。

## 區域可用性
<a name="getting-started-regional-availability"></a>

Amazon Cognito 可在全球多個 AWS 區域使用。在每個區域中，Amazon Cognito 都會分佈在多個可用區域。這些可用區域各自實體隔離，但以私有、低延遲、高輸送量、高度冗餘的網路連線加以整合。這些可用區域 AWS 可讓 提供服務，包括 Amazon Cognito，具有非常高的可用性和備援，同時將延遲降至最低。

若要查看 Amazon Cognito 目前是否可在任何 中使用 AWS 區域，請參閱[AWS 依區域提供服務](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/)。

若要了解區域 API 服務端點，請參閱 中的[AWS 區域和端點](https://docs.aws.amazon.com/general/latest/gr/rande.html##cognito_identity_region)*Amazon Web Services 一般參考*。

如需進一步了解各區域之可用區域數量的資訊，請參閱 [AWS ​ 全球基礎設施](https://aws.amazon.com/about-aws/global-infrastructure/)。

## Amazon Cognito 定價
<a name="pricing-for-amazon-cognito"></a>

如需 Amazon Cognito 定價的相關資訊，請參閱 [Amazon Cognito 定價](https://aws.amazon.com/cognito/pricing/)。

# 常見 Amazon Cognito 術語和概念
<a name="cognito-terms"></a>

Amazon Cognito 提供 Web 和行動應用程式的登入資料。它從*身分和存取管理*中常見的術語中提取和建置。提供許多通用身分和存取術語的指南。部分範例如下：
+ IDPro 知識內文中的[術語](https://bok.idpro.org/article/id/41/) 
+ [AWS Identity Services](https://aws.amazon.com/identity/)
+ NIST CSRC 的[詞彙表](https://csrc.nist.gov/glossary) 

下列清單說明 Amazon Cognito 獨有或在 Amazon Cognito 中具有特定內容的術語。

**Topics**
+ [一般](#cognito-terms-general)
+ [使用者集區](#cognito-terms-user-pools)
+ [身分集區](#cognito-terms-identity-pools)

## 一般
<a name="cognito-terms-general"></a>

此清單中的術語不是 Amazon Cognito 特有的，且受到身分和存取管理從業人員的廣泛認可。下列不是詳細的術語清單，而是本指南中特定 Amazon Cognito 內容的指南。

**存取權杖**  <a name="terms-accesstoken"></a>
JSON Web 權杖 (JWT)，其中包含實體存取資訊系統[之授權](#terms-authorization)的相關資訊。

**應用程式、應用程式**  
一般而言，行動應用程式。在本指南中，*應用程式*通常是連接到 Amazon Cognito 的 Web 應用程式或行動應用程式的速記。

**屬性型存取控制 (ABAC)**  <a name="terms-abac"></a>
一種模型，其中應用程式會根據使用者的屬性來決定對資源的存取，例如其職稱或部門。用於強制執行 ABAC 的 Amazon Cognito 工具會在使用者集區中包含 ID 字符，並在身分集區中包含[主體標籤](#term-afac)。

**身分驗證**  <a name="terms-authentication"></a>
為存取資訊系統而建立真實身分的程序。Amazon Cognito 接受第三方身分提供者的身分驗證證明，同時也是軟體應用程式的身分驗證提供者。

**授權**  <a name="terms-authorization"></a>
將許可授予資源的程序。使用者集區[存取字符](#terms-accesstoken)包含應用程式可用來允許使用者和系統存取資源的資訊。

**授權伺服器**  <a name="term-authzserver"></a>
產生 [JSON Web 字符](#terms-jwt)的 OAuth 或 OpenID Connect (OIDC) 系統。Amazon Cognito 使用者集區[受管授權伺服器](#terms-managedauthorizationserver)是使用者集區中兩種身分驗證和授權方法的授權伺服器元件。使用者集區也支援 [SDK 身分驗證](#terms-upapi)中的 API 挑戰回應流程。

**機密應用程式、伺服器端應用程式**  
使用者從遠端連線的應用程式，具有應用程式伺服器上的程式碼和對秘密的存取。這通常是 Web 應用程式。

**Identity provider (IdP) (身分提供者 (IdP))**  <a name="terms-idp"></a>
存放和驗證使用者身分的服務。Amazon Cognito 可以向[外部供應商](#terms-externalprovider)請求身分驗證，並成為應用程式的 IdP。

**JSON Web 字符 (JWT)**  <a name="terms-jwt"></a>
JSON 格式的文件，其中包含有關已驗證使用者的宣告。ID 權杖驗證使用者、存取權杖授權使用者，以及重新整理權杖更新憑證。Amazon Cognito 會從[外部供應商](#terms-externalprovider)接收字符，並向應用程式或 發出字符 AWS STS。

**Machine-to-machine(M2M) 授權**  <a name="terms-m2m"></a>
向non-user-interactive機器實體的 API 端點授權請求的程序，例如 Web 伺服器應用程式層。使用者集區在[存取權杖](#terms-accesstoken)中使用 OAuth 2.0 範圍的用戶端憑證授予中提供 M2M 授權。

**多重要素驗證 (MFA)**  <a name="terms-mfa"></a>
使用者在提供使用者名稱和密碼後提供額外身分驗證的要求。Amazon Cognito 使用者集區具有[本機使用者的](#terms-localuser) MFA 功能。

**OAuth 2.0 （社交） 供應商**  <a name="terms-oauth"></a>
提供 [JWT](#terms-jwt) 存取和重新整理字符的使用者集區或身分集區的 IdP。Amazon Cognito 使用者集區會在使用者驗證後自動與社交供應商互動。

**OpenID Connect (OIDC) 供應商**  
將 IdP 擴展 [OAuth](#terms-oauth) 規格以提供 ID 字符的使用者集區或身分集區。Amazon Cognito 使用者集區會在使用者驗證後自動與 OIDC 供應商互動。

**Passkey、WebAuthn**  
一種身分驗證形式，其中使用者裝置上的密碼編譯金鑰或通行金鑰可提供身分驗證證明。使用者驗證硬體或軟體驗證器中是否存在生物識別或 PIN 碼機制。通行密鑰是網路釣魚持久性，繫結至特定網站/應用程式，提供安全的無密碼體驗。Amazon Cognito 使用者集區支援使用通行金鑰登入。

**無密碼**  
一種身分驗證形式，使用者不需要輸入密碼。無密碼登入的方法包括傳送到電子郵件地址和電話號碼的一次性密碼 (OTPs)，以及通行金鑰。Amazon Cognito 使用者集區支援使用 OTPs 和通行金鑰登入。

**公有應用程式**  
在裝置上獨立存在的應用程式，其程式碼存放在本機，無法存取秘密。這通常是行動應用程式。

**資源伺服器**  
具有存取控制的 API。Amazon Cognito 使用者集區也會使用*資源伺服器*來描述定義與 API 互動組態的元件。

**角色型存取控制 (RBAC)**  
根據使用者的功能指定授予存取權的模型。Amazon Cognito 身分集區實作 RBAC，並區分 IAM 角色。

**服務供應商 (SP)、依賴方 (RP)**  <a name="terms-relyingparty"></a>
依賴 IdP 來宣告使用者可信任的應用程式。Amazon Cognito 做為外部 IdPs SP，以及做為應用程式型 SPs IdP。

**SAML 供應商**  
使用者集區或身分集區的 IdP，可產生您的使用者傳遞給 Amazon Cognito 的數位簽署聲明文件。

**通用唯一識別符 (UUID)**  <a name="terms-uuid"></a>
套用至物件的 128 位元標籤。Amazon Cognito UUIDs每個使用者集區或身分集區都是唯一的，但不符合特定的 UUID 格式。

**使用者目錄**  <a name="terms-userdirectory"></a>
使用者及其屬性的集合，可將該資訊提供給其他系統。Amazon Cognito 使用者集區是使用者目錄，也是從外部使用者目錄整合使用者的工具。

## 使用者集區
<a name="cognito-terms-user-pools"></a>

當您在本指南中看到下列清單中的術語時，它們會參考使用者集區的特定功能或組態。

**自適應身分驗證**  <a name="terms-adaptiveauthentication"></a>
[進階安全性](#term-advancedsecurity)的功能，可偵測潛在的惡意活動，並將額外的安全性套用至[使用者設定檔](#terms-userprofile)。

**應用程式用戶端**  <a name="term-appclient"></a>
將使用者集區的設定定義為一個應用程式的 IdP 的元件。

**回呼 URL、重新導向 URI、傳回 URL**  <a name="term-callbackurl"></a>
[應用程式用戶端](#term-appclient)中的設定，以及使用者集區[授權伺服器](#terms-managedauthorizationserver)請求中的參數。回呼 URL 是您[應用程式中](#term-app)已驗證使用者的初始目的地。

**以選擇為基礎的身分驗證**  <a name="terms-choicebasedauthentication"></a>
使用者集區的 API 身分驗證形式，其中每個使用者都有一組可用的登入選項。他們的選擇可能包括含或不含 MFA 的使用者名稱和密碼、通行金鑰登入，或含電子郵件或簡訊一次性密碼的無密碼登入。您的應用程式可以透過請求身分驗證選項清單或宣告偏好的選項，來塑造使用者的選擇程序。  
與[用戶端型身分驗證](#terms-declarativeauthentication)進行比較。

**用戶端型身分驗證**  <a name="terms-declarativeauthentication"></a>
使用者集區 API 和應用程式後端以 AWS SDKs建置的一種身分驗證形式。在宣告式身分驗證中，您的應用程式會獨立判斷使用者應執行的登入類型，並請求預先輸入。  
與以[選擇為基礎的身分驗證](#terms-choicebasedauthentication)進行比較。

**憑證洩漏**  
[進階安全性](#term-advancedsecurity)的一項功能，可偵測攻擊者可能知道的使用者密碼，並將額外的安全性套用至[使用者設定檔](#terms-userprofile)。

**確認**  <a name="terms-confirmation"></a>
判斷已符合先決條件以允許新使用者登入的程序。確認通常透過電子郵件地址或電話號碼[驗證](#terms-verification)完成。

**自訂身分驗證**  
使用 [Lambda 觸發條件](#terms-triggers)來定義其他使用者挑戰和回應的身分驗證程序延伸。

**裝置身分驗證**  
以使用受信任裝置 ID 的登入來取代 [MFA](#terms-mfa) 的身分驗證程序。

**網域、使用者集區網域**  <a name="terms-domain"></a>
託管受[管登入頁面](#terms-managedlogin)的 Web 網域 AWS。您可以在您擁有的網域中設定 DNS，或在 AWS 擁有的網域中使用識別子網域字首。

**基本計劃**  <a name="terms-essentialsplan"></a>
具有使用者集區中最新開發[的功能計劃](#terms-featureplan)。Essentials 計劃不包含 [Plus 計劃](#terms-plusplan)中的自動學習安全功能。

**外部供應商、第三方供應商**  <a name="terms-externalprovider"></a>
與使用者集區具有信任關係的 IdP。使用者集區做為外部提供者與您的應用程式之間的中繼實體，使用 SAML 2.0、OIDC 和社交提供者管理身分驗證程序。使用者集區會將外部供應商身分驗證結果合併為單一 IdP，讓您的應用程式可以使用單一 OIDC 依賴方程式庫來處理許多使用者。

**特徵計劃**  <a name="terms-featureplan"></a>
您可以為使用者集區選取的功能群組。特徵計劃在 AWS 帳單中具有不同的成本。新使用者集區預設為 [Essentials 計劃](#terms-essentialsplan)。  

**目前的計劃**
+ [Lite 計劃](#terms-liteplan)
+ [基本計劃](#terms-essentialsplan)
+ [Plus 計劃](#terms-plusplan)

**聯合身分使用者、外部使用者**  <a name="terms-federateduser"></a>
使用者集區中由[外部供應商](#terms-externalprovider)驗證的使用者。

**託管 UI （傳統）、託管 UI 頁面**  <a name="terms-hostedui"></a>
使用者集區網域上身分驗證前端、依賴方和身分提供者服務的早期版本。託管 UI 具有一組基本功能和簡化的外觀和風格。您可以使用上傳標誌影像檔案和具有預定一組 CSS 樣式的檔案來套用託管 UI 品牌。與[受管登入](#terms-managedlogin)比較。

**Lambda 觸發程序**  <a name="terms-triggers"></a>
中的函數 AWS Lambda ，使用者集區可以在使用者身分驗證程序的重點自動叫用該函數。您可以使用 Lambda 觸發來自訂身分驗證結果。

**本機使用者**  <a name="terms-localuser"></a>
使用者集區[使用者目錄中](#terms-userdirectory)的使用者[描述](#terms-userprofile)檔，不是透過向[外部供應商](#terms-externalprovider)進行身分驗證所建立。

**連結的使用者**  <a name="terms-linkeduser"></a>
來自[外部供應商](#terms-externalprovider)的使用者，其身分會與[本機使用者](#terms-localuser)合併。

**Lite 計劃**  <a name="terms-liteplan"></a>
具有最初使用使用者集區啟動之功能的特徵[計劃](#terms-featureplan)。Lite 計劃不包含 [Essentials 計劃](#terms-essentialsplan)中的新功能或 [Plus 計劃](#terms-plusplan)中的自動學習安全功能。

**受管授權伺服器、託管 UI 授權伺服器、授權伺服器**  <a name="terms-managedauthorizationserver"></a>
[受管登入](#terms-managedlogin)的元件，託管與[使用者集區網域](#terms-domain)上 IdPs和應用程式互動的服務。[託管 UI](#terms-hostedui) 與其提供的使用者互動功能中的受管登入不同，但具有相同的授權伺服器功能。

**受管登入、受管登入頁面**  <a name="terms-managedlogin"></a>
[使用者集區網域](#terms-domain)上的一組網頁，用於託管服務以進行使用者身分驗證。這些服務包括以 [IdP](#terms-idp) 身分運作的函數、第三方 IdPs的[依賴方](#terms-relyingparty)，以及使用者互動式身分驗證 UI 的伺服器。當您為使用者集區設定網域時，Amazon Cognito 會將所有受管登入頁面上線。  
您的應用程式匯入 OIDC 程式庫，可叫用使用者的瀏覽器，並將其導向受管登入 UI，以進行註冊、登入、密碼管理和其他身分驗證操作。身分驗證之後，OIDC 程式庫可以處理身分驗證請求的結果。

**受管登入身分驗證**  <a name="terms-managedloginauthentication"></a>
使用[使用者集區網域](#terms-domain)上的服務登入，使用使用者互動式瀏覽器頁面或 HTTPS API 請求完成。應用程式使用 OpenID Connect (OIDC) 程式庫處理受管登入身分驗證。此程序包括使用[外部供應商](#terms-externalprovider)登入、使用互動式受管登入頁面的本機使用者登入，以及 [M2M 授權](#terms-m2m)。使用傳統[託管 UI](#terms-hostedui) 進行身分驗證也屬於此術語。  
與 [AWS SDK 身分驗證](#terms-upapi)比較。

**Plus 計劃**  <a name="terms-plusplan"></a>
具有使用者集區中最新開發和進階安全功能的功能[計劃](#terms-featureplan)。

**SDK 身分驗證、 AWS SDK 身分驗證**  
您可以使用 AWS SDK 將一組身分驗證和授權 API 操作新增至應用程式後端。此身分驗證模型需要您自己的自訂登入機制。API 可以登入[本機使用者](#terms-localuser)和[連結的使用者](#terms-linkeduser)。  
與[受管登入身分驗證](#terms-managedloginauthentication)比較。

**威脅防護、進階安全功能**  <a name="term-advancedsecurity"></a>
在使用者集區中，威脅防護是指旨在緩解對您的身分驗證和授權機制的威脅的技術。自適應身分驗證、遭盜用憑證偵測和 IP 地址封鎖清單都屬於威脅防護類別。

**字符自訂**  
權杖產生前 [Lambda 觸發](#terms-triggers)的結果，可在執行時間修改使用者的 ID 或存取權杖。

**使用者集區、Amazon Cognito 身分提供者、`cognito-idp`、Amazon Cognito 使用者集區**  
針對使用 OIDC IdPs的應用程式，具有身分驗證和授權服務 AWS 的資源。

**驗證**  <a name="terms-verification"></a>
確認使用者擁有電子郵件地址或電話號碼的程序。使用者集區會將代碼傳送給已輸入新電子郵件地址或電話號碼的使用者。當他們將程式碼提交至 Amazon Cognito 時，他們會驗證訊息目的地的擁有權，並可以從使用者集區接收其他訊息。此外，請參閱[確認](#terms-confirmation)。

**使用者設定檔、使用者帳戶**  <a name="terms-userprofile"></a>
使用者[目錄中的使用者](#terms-userdirectory)項目。所有使用者，包括來自第三方 IdPs的使用者，在其使用者集區中都有設定檔。

## 身分集區
<a name="cognito-terms-identity-pools"></a>

當您在本指南中看到下列清單中的術語時，它們會參考身分集區的特定功能或組態。

**存取控制的屬性**  <a name="term-afac"></a>
在身分集區中實作[屬性型存取控制](#terms-abac)。身分集區會將使用者屬性做為標籤套用至使用者憑證。

**基本 （傳統） 身分驗證**  
您可以在此身分驗證程序自訂[使用者登入](#terms-usercredentials)資料的請求。

**開發人員驗證的身分**  
使用開發人員[登入資料授權身分集區使用者](#terms-usercredentials)登入資料的身分驗證程序。 [開發人員登入資料](#terms-developercredentials)

**開發人員登入資料**  <a name="terms-developercredentials"></a>
身分集區管理員的 IAM API 金鑰。

**增強型身分驗證**  
一種身分驗證流程，可根據您在身分集區中定義的邏輯，選取 IAM 角色並套用主體標籤。

**Identity**  
[UUID](#terms-uuid)，可將應用程式使用者及其[使用者登入](#terms-usercredentials)資料連結至與身分集區具有信任關係的外部[使用者目錄中](#terms-userdirectory)的設定檔。

**身分集區、Amazon Cognito 聯合身分、Amazon Cognito 身分、 `cognito-identity`**  
針對使用[臨時 AWS 登入資料](#terms-usercredentials)的應用程式，具有身分驗證和授權服務 AWS 的資源。

**未驗證的 身分**  
未使用身分集區 IdP 登入的使用者。您可以允許使用者在身分驗證之前，為單一 IAM 角色產生有限的使用者登入資料。

**使用者登入資料**  <a name="terms-usercredentials"></a>
使用者在身分集區身分驗證後收到的臨時 AWS API 金鑰。

# 入門 AWS
<a name="cognito-getting-started-account-iam"></a>

開始使用 Amazon Cognito 之前，請先自行設定一些必要的 AWS 資源。如果您已經可以登入 AWS 帳戶，您可以略過本節。如果您要尋找有關使用 AWS 登入資料註冊和登入的資訊，請繼續閱讀。擁有具有足夠 AWS Identity and Access Management (IAM) 許可的登入資料之後，您就可以開始使用[使用者集](getting-started-user-pools.md)區和[身分集](getting-started-with-identity-pools.md)區。

## 註冊 AWS 帳戶
<a name="sign-up-for-aws"></a>

如果您沒有 AWS 帳戶，請完成下列步驟來建立一個。

**註冊 AWS 帳戶**

1. 開啟 [https://portal.aws.amazon.com/billing/signup](https://portal.aws.amazon.com/billing/signup)。

1. 請遵循線上指示進行。

   部分註冊程序需接收來電或簡訊，並在電話鍵盤輸入驗證碼。

   當您註冊 時 AWS 帳戶，*AWS 帳戶根使用者*會建立 。根使用者有權存取該帳戶中的所有 AWS 服務 和資源。作為安全最佳實務，請將管理存取權指派給使用者，並且僅使用根使用者來執行[需要根使用者存取權的任務](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)。

AWS 會在註冊程序完成後傳送確認電子郵件給您。您可以隨時登錄 [https://aws.amazon.com/](https://aws.amazon.com/) 並選擇**我的帳戶**，以檢視您目前的帳戶活動並管理帳戶。

## 建立具有管理存取權的使用者
<a name="create-an-admin"></a>

註冊 後 AWS 帳戶，請保護 AWS 帳戶根使用者、啟用 AWS IAM Identity Center和建立管理使用者，以免將根使用者用於日常任務。

**保護您的 AWS 帳戶根使用者**

1.  選擇**根使用者**並輸入 AWS 帳戶 您的電子郵件地址，以帳戶擁有者[AWS 管理主控台](https://console.aws.amazon.com/)身分登入 。在下一頁中，輸入您的密碼。

   如需使用根使用者登入的說明，請參閱 *AWS 登入 使用者指南*中的[以根使用者身分登入](https://docs.aws.amazon.com/signin/latest/userguide/console-sign-in-tutorials.html#introduction-to-root-user-sign-in-tutorial)。

1. 若要在您的根使用者帳戶上啟用多重要素驗證 (MFA)。

   如需說明，請參閱《*IAM 使用者指南*》中的[為您的 AWS 帳戶 根使用者 （主控台） 啟用虛擬 MFA 裝置](https://docs.aws.amazon.com/IAM/latest/UserGuide/enable-virt-mfa-for-root.html)。

**建立具有管理存取權的使用者**

1. 啟用 IAM Identity Center。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[啟用 AWS IAM Identity Center](https://docs.aws.amazon.com//singlesignon/latest/userguide/get-set-up-for-idc.html)。

1. 在 IAM Identity Center 中，將管理存取權授予使用者。

   如需使用 IAM Identity Center 目錄 做為身分來源的教學課程，請參閱*AWS IAM Identity Center 《 使用者指南*》中的[使用預設值設定使用者存取 IAM Identity Center 目錄](https://docs.aws.amazon.com//singlesignon/latest/userguide/quick-start-default-idc.html)。

**以具有管理存取權的使用者身分登入**
+ 若要使用您的 IAM Identity Center 使用者簽署，請使用建立 IAM Identity Center 使用者時傳送至您電子郵件地址的簽署 URL。

  如需使用 IAM Identity Center 使用者登入的說明，請參閱*AWS 登入 《 使用者指南*》中的[登入 AWS 存取入口網站](https://docs.aws.amazon.com/signin/latest/userguide/iam-id-center-sign-in-tutorial.html)。

**指派存取權給其他使用者**

1. 在 IAM Identity Center 中，建立一個許可集來遵循套用最低權限的最佳實務。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[建立許可集](https://docs.aws.amazon.com//singlesignon/latest/userguide/get-started-create-a-permission-set.html)。

1. 將使用者指派至群組，然後對該群組指派單一登入存取權。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[新增群組](https://docs.aws.amazon.com//singlesignon/latest/userguide/addgroups.html)。