Updates the metadata document, SAML encryption settings, and private keys for an existing SAML provider. To rotate private keys, add your new private key and then remove the old key in a separate request.
You can also use this operation to set, change, or remove the trusted identity propagation context provider, and to associate or disassociate an IAM Identity Center instance with the provider. To remove a configuration rather than replace it, use the RemoveContextProvider and RemoveIdentityCenterInstance parameters. For each configuration, provide either the new value or the corresponding Remove flag in a single request, but not both.
A single request can change either the context provider or the provider metadata, but not both. Provider metadata includes the SAML metadata document, assertion encryption mode, private keys, and IAM Identity Center association. To change both, make separate UpdateSAMLProvider requests. To remove the context provider, first remove the IAM Identity Center association in a separate request.
To control who can configure trusted identity propagation on a SAML provider, use the iam:EnableIdentityPropagation, iam:EnableIdentityCenterAssociation, iam:RequestIdentityProviderIssuers, iam:ResourceIdentityProviderIssuers, iam:RequestIdentityCenterInstanceArn, and iam:ResourceIdentityCenterInstanceArn condition keys in IAM policies. The Request keys contain the values in the request. The Resource keys contain the values stored on the provider.
Parameters:
-
saml_metadata_document
(Optional[SAMLMetadataDocumentType], default:
None
)
–
An XML document generated by an identity provider (IdP) that supports SAML 2.0. The document includes the issuer's name, expiration information, and keys that can be used to validate the SAML authentication response (assertions) that are received from the IdP. You must generate the metadata document using the identity management software that is used as your IdP.
-
saml_provider_arn
(arnType)
–
The Amazon Resource Name (ARN) of the SAML provider to update.
For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
-
assertion_encryption_mode
(Optional[assertionEncryptionModeType], default:
None
)
–
Specifies the encryption setting for the SAML provider.
-
add_private_key
(Optional[privateKeyType], default:
None
)
–
Specifies the new private key from your external identity provider. The private key must be a .pem file that uses AES-GCM or AES-CBC encryption algorithm to decrypt SAML assertions.
-
remove_private_key
(Optional[privateKeyIdType], default:
None
)
–
The Key ID of the private key to remove.
-
context_provider
(Optional[ContextProvider], default:
None
)
–
The trusted identity propagation context provider configuration to associate with the SAML provider. This replaces the existing context provider configuration. For more information, see ContextProvider.
-
identity_center_instance_arn
(Optional[identityCenterInstanceArnType], default:
None
)
–
The Amazon Resource Name (ARN) of the IAM Identity Center instance to associate with the SAML provider.
For the format, see InstanceMetadata in the IAM Identity Center API Reference.
-
remove_context_provider
(Optional[booleanType], default:
None
)
–
Specifies whether to remove the existing trusted identity propagation context provider configuration from the SAML provider. When set to true, the context provider is removed. This parameter is mutually exclusive with ContextProvider.
-
remove_identity_center_instance
(Optional[booleanType], default:
None
)
–
Specifies whether to disassociate the IAM Identity Center instance from the SAML provider. When set to true, the instance is disassociated. This parameter is mutually exclusive with IdentityCenterInstanceArn.
Raises:
-
ConcurrentModificationException
–
The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.
-
InvalidInputException
–
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
LimitExceededException
–
The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.
-
NoSuchEntityException
–
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
-
ServiceFailureException
–
The request processing has failed because of an unknown error, exception or failure.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To set the context provider for a SAML provider
The following example sets a trusted identity propagation context provider on an existing SAML provider. The context provider uses the email attribute as the subject and maps the department attribute to a trusted context key.
>>> await client.update_saml_provider(saml_provider_arn='arn:aws:iam::123456789012:saml-provider/MyUniversity', context_provider={'SubjectSourceKey': 'email', 'SubjectTypeValue': 'user', 'KeyDefinitionList': [{'SourceKey': 'department', 'TargetKey': 'department'}]})
To associate an IAM Identity Center instance with a SAML provider
The following example associates an IAM Identity Center instance with an existing SAML provider.
>>> await client.update_saml_provider(saml_provider_arn='arn:aws:iam::123456789012:saml-provider/MyUniversity', identity_center_instance_arn='arn:aws:sso:::instance/ssoins-1234567890abcdef')
Source code in docs_src/capo_iam/_services/async_iam.py
| async def update_saml_provider(
self,
saml_provider_arn: "capo_iam.types.arn_type.arnType",
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
saml_metadata_document: Optional[
"capo_iam.types.saml_metadata_document_type.SAMLMetadataDocumentType"
] = None,
assertion_encryption_mode: Optional[
"capo_iam.types.assertion_encryption_mode_type.assertionEncryptionModeType"
] = None,
add_private_key: Optional[
"capo_iam.types.private_key_type.privateKeyType"
] = None,
remove_private_key: Optional[
"capo_iam.types.private_key_id_type.privateKeyIdType"
] = None,
context_provider: Optional[
"capo_iam.types.context_provider.ContextProvider"
] = None,
identity_center_instance_arn: Optional[
"capo_iam.types.identity_center_instance_arn_type.identityCenterInstanceArnType"
] = None,
remove_context_provider: Optional[
"capo_iam.types.boolean_type.booleanType"
] = None,
remove_identity_center_instance: Optional[
"capo_iam.types.boolean_type.booleanType"
] = None,
) -> "capo_iam.types.update_saml_provider_response.UpdateSAMLProviderResponse":
"""<p>Updates the metadata document, SAML encryption settings, and private keys for an existing SAML provider. To rotate private keys, add your new private key and then remove the old key in a separate request.</p> <p>You can also use this operation to set, change, or remove the trusted identity propagation context provider, and to associate or disassociate an IAM Identity Center instance with the provider. To remove a configuration rather than replace it, use the <code>RemoveContextProvider</code> and <code>RemoveIdentityCenterInstance</code> parameters. For each configuration, provide either the new value or the corresponding <code>Remove</code> flag in a single request, but not both.</p> <p>A single request can change either the context provider or the provider metadata, but not both. Provider metadata includes the SAML metadata document, assertion encryption mode, private keys, and IAM Identity Center association. To change both, make separate <code>UpdateSAMLProvider</code> requests. To remove the context provider, first remove the IAM Identity Center association in a separate request.</p> <p>To control who can configure trusted identity propagation on a SAML provider, use the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_EnableIdentityPropagation">iam:EnableIdentityPropagation</a>, <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_EnableIdentityCenterAssociation">iam:EnableIdentityCenterAssociation</a>, <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_RequestIdentityProviderIssuers">iam:RequestIdentityProviderIssuers</a>, <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_ResourceIdentityProviderIssuers">iam:ResourceIdentityProviderIssuers</a>, <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_RequestIdentityCenterInstanceArn">iam:RequestIdentityCenterInstanceArn</a>, and <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_ResourceIdentityCenterInstanceArn">iam:ResourceIdentityCenterInstanceArn</a> condition keys in IAM policies. The <code>Request</code> keys contain the values in the request. The <code>Resource</code> keys contain the values stored on the provider.</p>
Args:
saml_metadata_document: <p>An XML document generated by an identity provider (IdP) that supports SAML 2.0. The document includes the issuer's name, expiration information, and keys that can be used to validate the SAML authentication response (assertions) that are received from the IdP. You must generate the metadata document using the identity management software that is used as your IdP.</p>
saml_provider_arn: <p>The Amazon Resource Name (ARN) of the SAML provider to update.</p> <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
assertion_encryption_mode: <p>Specifies the encryption setting for the SAML provider.</p>
add_private_key: <p>Specifies the new private key from your external identity provider. The private key must be a .pem file that uses AES-GCM or AES-CBC encryption algorithm to decrypt SAML assertions.</p>
remove_private_key: <p>The Key ID of the private key to remove.</p>
context_provider: <p>The trusted identity propagation context provider configuration to associate with the SAML provider. This replaces the existing context provider configuration. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/APIReference/API_ContextProvider.html">ContextProvider</a>.</p>
identity_center_instance_arn: <p>The Amazon Resource Name (ARN) of the IAM Identity Center instance to associate with the SAML provider.</p> <p>For the format, see <a href="https://docs.aws.amazon.com/singlesignon/latest/APIReference/API_InstanceMetadata.html">InstanceMetadata</a> in the <i>IAM Identity Center API Reference</i>.</p>
remove_context_provider: <p>Specifies whether to remove the existing trusted identity propagation context provider configuration from the SAML provider. When set to <code>true</code>, the context provider is removed. This parameter is mutually exclusive with <code>ContextProvider</code>.</p>
remove_identity_center_instance: <p>Specifies whether to disassociate the IAM Identity Center instance from the SAML provider. When set to <code>true</code>, the instance is disassociated. This parameter is mutually exclusive with <code>IdentityCenterInstanceArn</code>.</p>
Raises:
capo_iam.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The request was rejected because multiple requests to change this object were submitted simultaneously. Wait a few minutes and submit your request again.</p>
capo_iam.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
capo_iam.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.</p>
capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
capo_iam.errors.service_failure_exception.ServiceFailureException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To set the context provider for a SAML provider
The following example sets a trusted identity propagation context provider on an existing SAML provider. The context provider uses the email attribute as the subject and maps the department attribute to a trusted context key.
>>> await client.update_saml_provider(saml_provider_arn='arn:aws:iam::123456789012:saml-provider/MyUniversity', context_provider={'SubjectSourceKey': 'email', 'SubjectTypeValue': 'user', 'KeyDefinitionList': [{'SourceKey': 'department', 'TargetKey': 'department'}]})
To associate an IAM Identity Center instance with a SAML provider
The following example associates an IAM Identity Center instance with an existing SAML provider.
>>> await client.update_saml_provider(saml_provider_arn='arn:aws:iam::123456789012:saml-provider/MyUniversity', identity_center_instance_arn='arn:aws:sso:::instance/ssoins-1234567890abcdef')
"""
async def _handler(
req: "AsyncOperationRequest[capo_iam.types.update_saml_provider_request.UpdateSAMLProviderRequest]",
) -> AsyncOperationResponse[
"capo_iam.types.update_saml_provider_response.UpdateSAMLProviderResponse"
]:
import capo_iam._operations.aws_identity_management_v20100508.update_saml_provider
(
output,
http_response,
) = await capo_iam._operations.aws_identity_management_v20100508.update_saml_provider.async_update_saml_provider(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_iam.types.update_saml_provider_request.UpdateSAMLProviderRequest",
) -> dict[str, Any]:
import capo_iam.types.update_saml_provider_request
return capo_iam.types.update_saml_provider_request.redact_sensitive(input_)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("UpdateSAMLProvider", redact_input=_redact_input),
)
input_: capo_iam.types.update_saml_provider_request.UpdateSAMLProviderRequest = {
"saml_provider_arn": saml_provider_arn
}
if saml_metadata_document is not None:
input_["saml_metadata_document"] = saml_metadata_document
if assertion_encryption_mode is not None:
input_["assertion_encryption_mode"] = assertion_encryption_mode
if add_private_key is not None:
input_["add_private_key"] = add_private_key
if remove_private_key is not None:
input_["remove_private_key"] = remove_private_key
if context_provider is not None:
input_["context_provider"] = context_provider
if identity_center_instance_arn is not None:
input_["identity_center_instance_arn"] = identity_center_instance_arn
if remove_context_provider is not None:
input_["remove_context_provider"] = remove_context_provider
if remove_identity_center_instance is not None:
input_["remove_identity_center_instance"] = remove_identity_center_instance
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|