連線至私有身分提供者
Amazon Bedrock AgentCore Identity 支援連線至 AWS VPC 內託管的 OAuth 2.0 身分提供者 (IdPs),例如自我託管 Keycloak、PingFederate 或其他符合 OIDC 規範的授權伺服器,無需將其公開至公有網際網路。這可讓您將私有 IdPs用於具有 AgentCore 執行期和 AgentCore Gateway 的傳入 JWT 授權,以及傳出 OAuth2 憑證提供者。
使用 Amazon VPC Lattice 資源閘道和資源組態建立與 VPC 託管 IdPs私有連線,遵循 AgentCore Gateway VPC 輸出所使用的相同模式。AgentCore Identity 使用AWSServiceRoleForBedrockAgentCoreIdentity服務連結角色來建立和管理您帳戶中的 VPC Lattice 資源,以私有連線至您的 IdP 端點。
重要
AgentCore 支援兩種 VPC Lattice 連線模式:受管 Lattice (簡易,AgentCore 處理資源生命週期) 和自我管理 Lattice (進階,具有跨帳戶支援和完整的控管可見性)。每種模式在複雜性、成本和控制方面都有不同的權衡。如需與優缺點的詳細比較,請參閱支援的 VPC 輸出模式。
使用案例
私有身分提供者在企業環境中很常見,其中組織:
-
在其 VPC 內執行自我託管授權伺服器,以滿足合規或資料駐留需求
-
使用無法公開存取的私有 OIDC 探索端點
-
需要所有身分驗證流量保持在 AWS 網路中,而不周遊公有網際網路
使用私有 IdP 的傳入 JWT 授權
當您設定 AgentCore Runtime 或 AgentCore Gateway 的傳入 JWT 授權時,授權方會使用探索 URL 來擷取 IdP 的公有金鑰 (JWKS),並驗證傳入的 JWT 權杖。如果您的 IdP 託管在 VPC 中,且探索 URL 不可公開存取,則必須設定私有端點,以便 AgentCore Identity 可以到達 IdP 的 OIDC 探索和 JWKS 端點。
使用私有 IdP 設定傳入授權
若要使用私有 IdP 設定傳入 JWT 授權,請在建立或更新 AgentCore 執行期或閘道時,在授權方組態中包含 privateEndpoint區塊。
範例:CreateAgentRuntime 搭配傳入身分驗證的私有 IdP
{ "agentRuntimeName": "my-runtime", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-agent-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "managedVpcResource": { "vpcIdentifier": "vpc-0abc123def456", "subnetIds": [ "subnet-0abc123", "subnet-0def456" ], "endpointIpAddressType": "IPV4", "securityGroupIds": [ "sg-0abc123def" ] } } } } }
範例:CreateGateway 搭配傳入身分驗證的私有 IdP
{ "name": "my-gateway", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-gateway-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "managedVpcResource": { "vpcIdentifier": "vpc-0abc123def456", "subnetIds": [ "subnet-0abc123", "subnet-0def456" ], "endpointIpAddressType": "IPV4", "securityGroupIds": [ "sg-0abc123def" ] } } } } }
如果您的 IdP 使用私有憑證授權單位發行的 TLS 憑證,您可以將具有公有 ACM 憑證的內部 Application Load Balancer 放在其前面。如需詳細資訊,請參閱私有憑證的因應措施:ALB。
對於自我管理的 Lattice,請將 取代managedVpcResource為 selfManagedLatticeResource:
範例:CreateAgentRuntime 搭配傳入身分驗證的自我管理 Lattice
{ "agentRuntimeName": "my-runtime", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-agent-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "selfManagedLatticeResource": { "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123" } } } } }
範例:CreateGateway 搭配傳入身分驗證的自我管理 Lattice
{ "name": "my-gateway", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-gateway-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "selfManagedLatticeResource": { "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123" } } } } }
具有私有 IdP 的傳出 OAuth 憑證提供者
當您設定使用私有 IdP 的傳出 OAuth2 登入資料提供者時,AgentCore Identity 需要連線到 IdP 的字符端點,才能交換存取字符的授權碼或執行用戶端登入資料授權。如果 IdP 的權杖端點託管在 VPC 內,您必須在登入資料提供者上設定私有端點。
使用私有 IdP 設定傳出憑證提供者
若要使用私有 IdP 設定傳出 OAuth 憑證提供者,請在使用具有手動組態的自訂提供者建立憑證提供者時包含 privateEndpoint區塊。
範例:使用私有 IdP 建立 OAuth 登入資料提供者
{ "name": "my-private-idp-provider", "credentialProviderType": "OAUTH", "oauthCredentialProvider": { "providerType": "CUSTOM", "customProviderConfiguration": { "issuer": "https://idp.internal.example.com/realms/my-realm", "authorizationEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/auth", "tokenEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/token" }, "clientId": "my-client-id", "clientSecret": "my-client-secret", "privateEndpoint": { "managedVpcResource": { "vpcIdentifier": "vpc-0abc123def456", "subnetIds": [ "subnet-0abc123", "subnet-0def456" ], "endpointIpAddressType": "IPV4", "securityGroupIds": [ "sg-0abc123def" ] } } } }
對於自我管理的 Lattice,請將 取代managedVpcResource為 selfManagedLatticeResource:
{ "name": "my-private-idp-provider", "credentialProviderType": "OAUTH", "oauthCredentialProvider": { "providerType": "CUSTOM", "customProviderConfiguration": { "issuer": "https://idp.internal.example.com/realms/my-realm", "authorizationEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/auth", "tokenEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/token" }, "clientId": "my-client-id", "clientSecret": "my-client-secret", "privateEndpoint": { "selfManagedLatticeResource": { "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123" } } } }
先決條件
設定私有身分提供者之前,請確定下列事項:
-
您的身分提供者正在 VPC 中執行和存取。
-
IdP 的 OIDC 探索端點 (
/.well-known/openid-configuration)、JWKS 端點和字符端點可從指定的子網路連接。 -
您的安全群組允許 IdP 所使用的連接埠 (通常是 HTTPS 的連接埠 443) 上的傳入流量。
-
對於受管 Lattice,您的 IAM 主體必須具有
iam:CreateServiceLinkedRole許可,以便 AgentCore 可以代表您建立 Identity Network 服務連結角色。如需必要的 IAM 政策,請參閱 Identity Network 服務連結角色。 -
對於受管 Lattice,您的 IAM 主體
ec2:CreateNetworkInterface也需要下列 Amazon EC2 許可:
私有身分提供者的服務連結角色
當您為身分提供者設定私有端點時,AgentCore Identity 會使用AWSServiceRoleForBedrockAgentCoreIdentity服務連結角色來管理與 VPC 託管 IdP 的連線。此角色會在您第一次為身分提供者設定受管私有端點時自動建立,前提是您的 IAM 主體具有必要的iam:CreateServiceLinkedRole許可。
如需建立、編輯和刪除此角色的完整政策文件和說明,請參閱 Identity Network 服務連結角色。
限制及考量
-
探索 URL 必須是 HTTPS :IdP 的 OIDC 探索 URL 必須使用 HTTPS。不支援 HTTP 端點。
-
私有憑證 :您的 IdP 必須使用公開信任的 TLS 憑證,或者您必須將具有公有 ACM 憑證的 ALB 放在其前面。如需詳細資訊,請參閱私有憑證的因應措施:ALB。
-
跨帳戶 :跨帳戶私有 IdP 連線需要自我管理的 Lattice 選項。Managed Lattice 不支援跨帳戶案例。
如需與 VPC Lattice 連線相關的其他限制,請參閱使用 VPC Lattice 連線至 VPC 中的私有資源中的限制和考量事項。