CognitoIdentityProvider / Client / set_risk_configuration
set_risk_configuration#
- CognitoIdentityProvider.Client.set_risk_configuration(**kwargs)#
Configures actions on detected risks. To delete the risk configuration for
UserPoolId
orClientId
, pass null values for all four configuration types.To activate Amazon Cognito advanced security features, update the user pool to include the
UserPoolAddOns
keyAdvancedSecurityMode
.See also: AWS API Documentation
Request Syntax
response = client.set_risk_configuration( UserPoolId='string', ClientId='string', CompromisedCredentialsRiskConfiguration={ 'EventFilter': [ 'SIGN_IN'|'PASSWORD_CHANGE'|'SIGN_UP', ], 'Actions': { 'EventAction': 'BLOCK'|'NO_ACTION' } }, AccountTakeoverRiskConfiguration={ 'NotifyConfiguration': { 'From': 'string', 'ReplyTo': 'string', 'SourceArn': 'string', 'BlockEmail': { 'Subject': 'string', 'HtmlBody': 'string', 'TextBody': 'string' }, 'NoActionEmail': { 'Subject': 'string', 'HtmlBody': 'string', 'TextBody': 'string' }, 'MfaEmail': { 'Subject': 'string', 'HtmlBody': 'string', 'TextBody': 'string' } }, 'Actions': { 'LowAction': { 'Notify': True|False, 'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION' }, 'MediumAction': { 'Notify': True|False, 'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION' }, 'HighAction': { 'Notify': True|False, 'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION' } } }, RiskExceptionConfiguration={ 'BlockedIPRangeList': [ 'string', ], 'SkippedIPRangeList': [ 'string', ] } )
- Parameters:
UserPoolId (string) –
[REQUIRED]
The user pool ID.
ClientId (string) –
The app client ID. If
ClientId
is null, then the risk configuration is mapped touserPoolId
. When the client ID is null, the same risk configuration is applied to all the clients in the userPool.Otherwise,
ClientId
is mapped to the client. When the client ID isn’t null, the user pool configuration is overridden and the risk configuration for the client is used instead.CompromisedCredentialsRiskConfiguration (dict) –
The compromised credentials risk configuration.
EventFilter (list) –
Perform the action for these events. The default is to perform all events if no event filter is specified.
(string) –
Actions (dict) – [REQUIRED]
The compromised credentials risk configuration actions.
EventAction (string) – [REQUIRED]
The event action.
AccountTakeoverRiskConfiguration (dict) –
The account takeover risk configuration.
NotifyConfiguration (dict) –
The notify configuration used to construct email notifications.
From (string) –
The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.
ReplyTo (string) –
The destination to which the receiver of an email should reply to.
SourceArn (string) – [REQUIRED]
The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the
From
parameter.BlockEmail (dict) –
Email template used when a detected risk event is blocked.
Subject (string) – [REQUIRED]
The email subject.
HtmlBody (string) –
The email HTML body.
TextBody (string) –
The email text body.
NoActionEmail (dict) –
The email template used when a detected risk event is allowed.
Subject (string) – [REQUIRED]
The email subject.
HtmlBody (string) –
The email HTML body.
TextBody (string) –
The email text body.
MfaEmail (dict) –
The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.
Subject (string) – [REQUIRED]
The email subject.
HtmlBody (string) –
The email HTML body.
TextBody (string) –
The email text body.
Actions (dict) – [REQUIRED]
Account takeover risk configuration actions.
LowAction (dict) –
Action to take for a low risk.
Notify (boolean) – [REQUIRED]
Flag specifying whether to send a notification.
EventAction (string) – [REQUIRED]
The action to take in response to the account takeover action. Valid values are as follows:
BLOCK
Choosing this action will block the request.MFA_IF_CONFIGURED
Present an MFA challenge if user has configured it, else allow the request.MFA_REQUIRED
Present an MFA challenge if user has configured it, else block the request.NO_ACTION
Allow the user to sign in.
MediumAction (dict) –
Action to take for a medium risk.
Notify (boolean) – [REQUIRED]
Flag specifying whether to send a notification.
EventAction (string) – [REQUIRED]
The action to take in response to the account takeover action. Valid values are as follows:
BLOCK
Choosing this action will block the request.MFA_IF_CONFIGURED
Present an MFA challenge if user has configured it, else allow the request.MFA_REQUIRED
Present an MFA challenge if user has configured it, else block the request.NO_ACTION
Allow the user to sign in.
HighAction (dict) –
Action to take for a high risk.
Notify (boolean) – [REQUIRED]
Flag specifying whether to send a notification.
EventAction (string) – [REQUIRED]
The action to take in response to the account takeover action. Valid values are as follows:
BLOCK
Choosing this action will block the request.MFA_IF_CONFIGURED
Present an MFA challenge if user has configured it, else allow the request.MFA_REQUIRED
Present an MFA challenge if user has configured it, else block the request.NO_ACTION
Allow the user to sign in.
RiskExceptionConfiguration (dict) –
The configuration to override the risk decision.
BlockedIPRangeList (list) –
Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.
(string) –
SkippedIPRangeList (list) –
Risk detection isn’t performed on the IP addresses in this range list. The IP range is in CIDR notation.
(string) –
- Return type:
dict
- Returns:
Response Syntax
{ 'RiskConfiguration': { 'UserPoolId': 'string', 'ClientId': 'string', 'CompromisedCredentialsRiskConfiguration': { 'EventFilter': [ 'SIGN_IN'|'PASSWORD_CHANGE'|'SIGN_UP', ], 'Actions': { 'EventAction': 'BLOCK'|'NO_ACTION' } }, 'AccountTakeoverRiskConfiguration': { 'NotifyConfiguration': { 'From': 'string', 'ReplyTo': 'string', 'SourceArn': 'string', 'BlockEmail': { 'Subject': 'string', 'HtmlBody': 'string', 'TextBody': 'string' }, 'NoActionEmail': { 'Subject': 'string', 'HtmlBody': 'string', 'TextBody': 'string' }, 'MfaEmail': { 'Subject': 'string', 'HtmlBody': 'string', 'TextBody': 'string' } }, 'Actions': { 'LowAction': { 'Notify': True|False, 'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION' }, 'MediumAction': { 'Notify': True|False, 'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION' }, 'HighAction': { 'Notify': True|False, 'EventAction': 'BLOCK'|'MFA_IF_CONFIGURED'|'MFA_REQUIRED'|'NO_ACTION' } } }, 'RiskExceptionConfiguration': { 'BlockedIPRangeList': [ 'string', ], 'SkippedIPRangeList': [ 'string', ] }, 'LastModifiedDate': datetime(2015, 1, 1) } }
Response Structure
(dict) –
RiskConfiguration (dict) –
The risk configuration.
UserPoolId (string) –
The user pool ID.
ClientId (string) –
The app client ID.
CompromisedCredentialsRiskConfiguration (dict) –
The compromised credentials risk configuration object, including the
EventFilter
and theEventAction
.EventFilter (list) –
Perform the action for these events. The default is to perform all events if no event filter is specified.
(string) –
Actions (dict) –
The compromised credentials risk configuration actions.
EventAction (string) –
The event action.
AccountTakeoverRiskConfiguration (dict) –
The account takeover risk configuration object, including the
NotifyConfiguration
object andActions
to take if there is an account takeover.NotifyConfiguration (dict) –
The notify configuration used to construct email notifications.
From (string) –
The email address that is sending the email. The address must be either individually verified with Amazon Simple Email Service, or from a domain that has been verified with Amazon SES.
ReplyTo (string) –
The destination to which the receiver of an email should reply to.
SourceArn (string) –
The Amazon Resource Name (ARN) of the identity that is associated with the sending authorization policy. This identity permits Amazon Cognito to send for the email address specified in the
From
parameter.BlockEmail (dict) –
Email template used when a detected risk event is blocked.
Subject (string) –
The email subject.
HtmlBody (string) –
The email HTML body.
TextBody (string) –
The email text body.
NoActionEmail (dict) –
The email template used when a detected risk event is allowed.
Subject (string) –
The email subject.
HtmlBody (string) –
The email HTML body.
TextBody (string) –
The email text body.
MfaEmail (dict) –
The multi-factor authentication (MFA) email template used when MFA is challenged as part of a detected risk.
Subject (string) –
The email subject.
HtmlBody (string) –
The email HTML body.
TextBody (string) –
The email text body.
Actions (dict) –
Account takeover risk configuration actions.
LowAction (dict) –
Action to take for a low risk.
Notify (boolean) –
Flag specifying whether to send a notification.
EventAction (string) –
The action to take in response to the account takeover action. Valid values are as follows:
BLOCK
Choosing this action will block the request.MFA_IF_CONFIGURED
Present an MFA challenge if user has configured it, else allow the request.MFA_REQUIRED
Present an MFA challenge if user has configured it, else block the request.NO_ACTION
Allow the user to sign in.
MediumAction (dict) –
Action to take for a medium risk.
Notify (boolean) –
Flag specifying whether to send a notification.
EventAction (string) –
The action to take in response to the account takeover action. Valid values are as follows:
BLOCK
Choosing this action will block the request.MFA_IF_CONFIGURED
Present an MFA challenge if user has configured it, else allow the request.MFA_REQUIRED
Present an MFA challenge if user has configured it, else block the request.NO_ACTION
Allow the user to sign in.
HighAction (dict) –
Action to take for a high risk.
Notify (boolean) –
Flag specifying whether to send a notification.
EventAction (string) –
The action to take in response to the account takeover action. Valid values are as follows:
BLOCK
Choosing this action will block the request.MFA_IF_CONFIGURED
Present an MFA challenge if user has configured it, else allow the request.MFA_REQUIRED
Present an MFA challenge if user has configured it, else block the request.NO_ACTION
Allow the user to sign in.
RiskExceptionConfiguration (dict) –
The configuration to override the risk decision.
BlockedIPRangeList (list) –
Overrides the risk decision to always block the pre-authentication requests. The IP range is in CIDR notation, a compact representation of an IP address and its routing prefix.
(string) –
SkippedIPRangeList (list) –
Risk detection isn’t performed on the IP addresses in this range list. The IP range is in CIDR notation.
(string) –
LastModifiedDate (datetime) –
The last modified date.
Exceptions
CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
CognitoIdentityProvider.Client.exceptions.InvalidParameterException
CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
CognitoIdentityProvider.Client.exceptions.UserPoolAddOnNotEnabledException
CognitoIdentityProvider.Client.exceptions.CodeDeliveryFailureException
CognitoIdentityProvider.Client.exceptions.InvalidEmailRoleAccessPolicyException
CognitoIdentityProvider.Client.exceptions.InternalErrorException