setRiskConfiguration method
- required String userPoolId,
- AccountTakeoverRiskConfigurationType? accountTakeoverRiskConfiguration,
- String? clientId,
- CompromisedCredentialsRiskConfigurationType? compromisedCredentialsRiskConfiguration,
- RiskExceptionConfigurationType? riskExceptionConfiguration,
Configures actions on detected risks. To delete the risk configuration for
UserPoolId
or ClientId
, pass null values for all
four configuration types.
To enable Amazon Cognito advanced security features, update the user pool
to include the UserPoolAddOns
keyAdvancedSecurityMode
.
May throw ResourceNotFoundException. May throw InvalidParameterException. May throw TooManyRequestsException. May throw NotAuthorizedException. May throw UserPoolAddOnNotEnabledException. May throw CodeDeliveryFailureException. May throw InvalidEmailRoleAccessPolicyException. May throw InternalErrorException.
Parameter userPoolId
:
The user pool ID.
Parameter accountTakeoverRiskConfiguration
:
The account takeover risk configuration.
Parameter clientId
:
The app client ID. If ClientId
is null, then the risk
configuration is mapped to userPoolId
. 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 is not null, the user pool configuration is overridden and the risk
configuration for the client is used instead.
Parameter compromisedCredentialsRiskConfiguration
:
The compromised credentials risk configuration.
Parameter riskExceptionConfiguration
:
The configuration to override the risk decision.
Implementation
Future<SetRiskConfigurationResponse> setRiskConfiguration({
required String userPoolId,
AccountTakeoverRiskConfigurationType? accountTakeoverRiskConfiguration,
String? clientId,
CompromisedCredentialsRiskConfigurationType?
compromisedCredentialsRiskConfiguration,
RiskExceptionConfigurationType? riskExceptionConfiguration,
}) async {
ArgumentError.checkNotNull(userPoolId, 'userPoolId');
_s.validateStringLength(
'userPoolId',
userPoolId,
1,
55,
isRequired: true,
);
_s.validateStringLength(
'clientId',
clientId,
1,
128,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.SetRiskConfiguration'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'UserPoolId': userPoolId,
if (accountTakeoverRiskConfiguration != null)
'AccountTakeoverRiskConfiguration': accountTakeoverRiskConfiguration,
if (clientId != null) 'ClientId': clientId,
if (compromisedCredentialsRiskConfiguration != null)
'CompromisedCredentialsRiskConfiguration':
compromisedCredentialsRiskConfiguration,
if (riskExceptionConfiguration != null)
'RiskExceptionConfiguration': riskExceptionConfiguration,
},
);
return SetRiskConfigurationResponse.fromJson(jsonResponse.body);
}