

 从补丁 198 开始，Amazon Redshift 将不再支持创建新的 Python UDF。现有的 Python UDF 将继续正常运行至 2026 年 6 月 30 日。有关更多信息，请参阅[博客文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

# 使用可信令牌发布者将应用程序或工具与 OAuth 集成
<a name="redshift-iam-access-control-idp-connect-oauth"></a>

 您可以向所创建的客户端工具中添加功能，以通过 AWS IAM Identity Center 连接来连接到 Redshift。如果您已经配置了 Redshift 与 AWS IAM Identity Center 的集成，请使用此部分中详述的属性来设置连接。

## 用于使用 AWS IAM Identity Center 连接到 Redshift 的身份验证插件
<a name="redshift-iam-access-control-idp-connect-plugin"></a>

您可以使用以下驱动程序插件，通过 AWS IAM Identity Center 连接到 Amazon Redshift：
+  `BrowserIdcAuthPlugin` – 此插件促进实现与 AWS IAM Identity Center 的无缝单点登录集成。插件会创建一个浏览器窗口，供用户使用其企业身份提供者中定义的用户凭证进行登录。
+  `IdpTokenAuthPlugin` – 此插件应由想要自行管理身份验证流程，而不是让 Amazon Redshift 驱动程序打开浏览器窗口进行 AWS IAM Identity Center 身份验证的应用程序使用。插件接受 AWS IAM Identity Center 提供的访问令牌，或 OpenID Connect（OIDC）JSON Web 令牌（JWT），该令牌由与 AWS IAM Identity Center 关联的任意 Web 身份提供者提供，例如 Okta、PingOne 和 Microsoft Entra ID（Azure AD）。客户端应用程序负责生成此必需的访问令牌/JWT。

### 使用 `BrowserIdcAuthPlugin` 进行身份验证
<a name="redshift-iam-access-control-idp-connect-plugin-browseridcauthplugin"></a>

根据您的 Amazon Redshift 驱动程序，使用以下插件名称，通过 `BrowserIdcAuthPlugin` 进行连接。


| 驱动程序 | 连接选项键 | 值 | 备注 | 
| --- | --- | --- | --- | 
| JDBC | `plugin_name` | com.amazon.redshift.plugin.BrowserIdcAuthPlugin | 在连接时，您必须输入插件的完全限定类名。 | 
| ODBC | `plugin_name` | BrowserIdcAuthPlugin |  | 
| Python | `credentials_provider` | BrowserIdcAuthPlugin | Python 驱动程序没有 `plugin_name` 选项可用。请改用`credentials_provider`。 | 

`BrowserIdcAuthPlugin` 插件具有以下额外的连接选项：


| 选项名称 | 必填？ | 说明 | 示例 | 
| --- | --- | --- | --- | 
| idc\_region | 必需 | AWS IAM Identity Center 实例所在的 AWS 区域。 | us-east-1 | 
| issuer\_url | 必需 | AWS IAM Identity Center 服务器的实例端点。您可以使用 AWS IAM Identity Center 控制台查找此值。 | https://identitycenter.amazonaws.com/ssoins-g5j2k70sn4yc5nsc | 
| listen\_port | 可选 | Amazon Redshift 驱动程序用来通过浏览器重定向接收来自 AWS IAM Identity Center 的 `auth_code` 响应的端口。 | 7890 | 
| idc\_client\_display\_name | 可选 | 在 AWS IAM Identity Center 的单点登录同意弹出窗口中，AWS IAM Identity Center 客户端为应用程序使用的名称。 | Amazon Redshift 驱动程序 | 
| idp\_response\_timeout | 可选 | Redshift 驱动程序等待身份验证流程完成的时间，以秒为单位。 | 60 | 

您必须输入自己创建并用于连接的工具的这些连接属性值。有关更多信息，请参阅相应的各个驱动程序的连接选项文档：
+ [JDBC 驱动程序版本 2.x 配置的选项](jdbc20-configuration-options.md)
+ [ODBC 驱动程序选项](odbc20-configuration-options.md)
+ [Amazon Redshift Python 连接器的配置选项](python-configuration-options.md)

### 使用 `IdpTokenAuthPlugin` 进行身份验证
<a name="redshift-iam-access-control-idp-connect-plugin-idptokenauthplugin"></a>

根据您的 Amazon Redshift 驱动程序，使用以下插件名称，通过 `IdpTokenAuthPlugin` 进行连接。


| 驱动程序 | 连接选项键 | 值 | 备注 | 
| --- | --- | --- | --- | 
| JDBC | `plugin_name` | com.amazon.redshift.plugin.IdpTokenAuthPlugin | 在连接时，您必须输入插件的完全限定类名。 | 
| ODBC | `plugin_name` | IdpTokenAuthPlugin |  | 
| Python | `credentials_provider` | IdpTokenAuthPlugin | Python 驱动程序没有 `plugin_name` 选项可用。请改用`credentials_provider`。 | 

`IdpTokenAuthPlugin` 插件具有以下额外的连接选项：


| 选项名称 | 必填？ | 说明 | 
| --- | --- | --- | 
| 令牌 | 必需 | AWS IAM Identity Center 提供的访问令牌，或 OpenID Connect（OIDC）JSON Web 令牌（JWT，JSON Web Token），该令牌由与 AWS IAM Identity Center 连接的 Web 身份提供者提供。您的应用程序必须通过 AWS IAM Identity Center 或与 AWS IAM Identity Center 连接的身份提供者，对您的应用程序用户进行身份验证，从而生成此令牌。 | 
| token\_type | 必需 | 用于 `IdpTokenAuthPlugin` 的令牌类型。可能的值包括：[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/redshift/latest/mgmt/redshift-iam-access-control-idp-connect-oauth.html) | 

您必须输入自己创建并用于连接的工具的这些连接属性值。有关更多信息，请参阅相应的各个驱动程序的连接选项文档：
+ [JDBC 驱动程序版本 2.x 配置的选项](jdbc20-configuration-options.md)
+ [ODBC 驱动程序选项](odbc20-configuration-options.md)
+ [Amazon Redshift Python 连接器的配置选项](python-configuration-options.md)