使用身份提供者插件
有关如何使用身份提供者插件的一般信息,请参阅用于提供 IAM 凭证的选项。有关管理 IAM 身份的更多信息,包括 IAM 角色的最佳实践,请参阅 Amazon Redshift 中的 Identity and Access Management。
使用 ADFS 身份提供者插件进行身份验证
以下是使用 Active Directory 联合身份验证服务(ADFS)身份提供者插件对连接到 Amazon Redshift 数据库的用户进行身份验证的示例。
>>> con = redshift_connector.connect(
iam=True,
database='dev',
host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com',
cluster_identifier='my-testing-cluster',
credentials_provider='AdfsCredentialsProvider',
user='brooke@myadfshostname.com',
password='Hunter2',
idp_host='myadfshostname.com'
)
使用 Azure 身份提供者插件进行身份验证
以下是使用 Azure 身份提供者插件进行身份验证的示例。您可以为 client_id
和 client_secret
创建值用于 Azure 企业应用程序,如下所示。
>>> con = redshift_connector.connect(
iam=True,
database='dev',
host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com',
cluster_identifier='my-testing-cluster',
credentials_provider='AzureCredentialsProvider',
user='brooke@myazure.org',
password='Hunter2',
idp_tenant='my_idp_tenant',
client_id='my_client_id',
client_secret='my_client_secret',
preferred_role='arn:aws:iam:123:role/DataScientist'
)
使用 AWS IAM Identity Center 身份提供者插件进行身份验证
以下是使用 AWS IAM Identity Center 身份提供者插件进行身份验证的示例。
with redshift_connector.connect(
credentials_provider='BrowserIdcAuthPlugin',
host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com',
database='dev',
idc_region='us-east-1',
issuer_url='https://identitycenter.amazonaws.com/ssoins-790723ebe09c86f9',
idp_response_timeout=60,
listen_port=8100,
idc_client_display_name='Test Display Name',
# port value of 5439 is specified by default
)
使用 Azure 浏览器身份提供者插件进行身份验证
以下是使用 Azure 浏览器身份提供者插件对连接到 Amazon Redshift 数据库的用户进行身份验证的示例。
浏览器中会发生多重身份验证,其中登录凭证由用户提供。
>>>con = redshift_connector.connect(
iam=True,
database='dev',
host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com',
cluster_identifier='my-testing-cluster',
credentials_provider='BrowserAzureCredentialsProvider',
idp_tenant='my_idp_tenant',
client_id='my_client_id',
)
使用 Okta 身份提供者插件进行身份验证
以下是使用 Okta 身份提供者插件进行身份验证的示例。你可以通过 Okta 应用程序获取 idp_host
、app_id
和 app_name
的值。
>>> con = redshift_connector.connect(
iam=True,
database='dev',
host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com',
cluster_identifier='my-testing-cluster',
credentials_provider='OktaCredentialsProvider',
user='brooke@myazure.org',
password='hunter2',
idp_host='my_idp_host',
app_id='my_first_appetizer',
app_name='dinner_party'
)
使用 JumpCloud 和通用 SAML 浏览器身份提供者插件进行身份验证
以下是使用 JumpCloud 和通用 SAML 浏览器身份提供者插件进行身份验证的示例。
密码参数是必需的。但是,您不必输入此参数,因为浏览器中会发生多重验证。
>>> con = redshift_connector.connect(
iam=True,
database='dev',
host='my-testing-cluster.abc.us-east-2.redshift.amazonaws.com',
cluster_identifier='my-testing-cluster',
credentials_provider='BrowserSamlCredentialsProvider',
user='brooke@myjumpcloud.org',
password='',
login_url='https://sso.jumpcloud.com/saml2/plustwo_melody'
)