Create Risk Policy Set
POST {{apiPath}}/environments/{{envID}}/riskPolicySets
The POST /environments/{{envID}}/riskPolicySets
operation adds a new risk policy set to the specified environment.
This example uses the Scores approach for combining the individual predictors.
Note that condition.type
is set to AGGREGATED_SCORES, and that the request contains the array condition.aggregatedScores
rather than condition.aggregatedWeights
.
Prerequisites
- See PingOne Protect and Risk Policies for important overview information.
See Risk Predictors for more information, including the data models.
Base data model
Property | Type | Required? |
---|---|---|
createdAt | Date | Required |
default | Boolean | Optional |
defaultResult | Object | Optional |
description | String | Optional |
environment.id | String | Required |
evaluatedPredictors | String[] | Optional |
id | String | Required |
name | String | Required |
riskPolicies | String[] | Required |
triggers | Object[] | Optional |
triggers.type | String | Required |
triggers.policySet | Object | Required |
triggers.policySet.id | String | Required |
triggers.expiresAt | String | Required |
updatedAt | Date | Required |
Risk policies data model
This table lists the fields and objects that can be included in each of the elements in the riskPolicies
array.
Property | Type | Required? |
---|---|---|
condition | Object | Required |
condition.aggregatedScores | Array | Required/Optional |
condition.aggregatedScores.value | String | Required |
condition.aggregatedScores.score | Integer | Required |
condition.type | String | Required |
condition.between.minScore | Integer | Required/Optional |
condition.between.maxScore | Integer | Required/Optional |
createdAt | Date | Required |
description | String | Optional |
id | String | Required |
name | String | Required |
priority | Integer | Required |
result.level | String | Required |
updatedAt | Date | Required |
Request Body
{"name"=>"Score-based policy", "default"=>false, "defaultResult"=>{"level"=>"Low"}, "riskPolicies"=>[{"name"=>"ANONYMOUS_NETWORK_DETECTION", "result"=>{"level"=>"HIGH"}, "condition"=>{"value"=>"${details.anonymousNetworkDetected}", "equals"=>true}}, {"name"=>"GEOVELOCITY_ANOMALY", "result"=>{"level"=>"MEDIUM"}, "condition"=>{"value"=>"${details.impossibleTravel}", "equals"=>true}}, {"name"=>"Medium scored policy", "result"=>{"level"=>"MEDIUM"}, "condition"=>{"type"=>"AGGREGATED_SCORES", "aggregatedScores"=>[{"value"=>"${details.userLocationAnomaly.level}", "score"=>40}, {"value"=>"${details.anonymousNetwork.level}", "score"=>60}, {"value"=>"${details.ipRisk.level}", "score"=>40}], "between"=>{"minScore"=>700, "maxScore"=>900}}}, {"name"=>"High scored policy", "result"=>{"level"=>"HIGH"}, "condition"=>{"type"=>"AGGREGATED_SCORES", "aggregatedScores"=>[{"value"=>"${details.userLocationAnomaly.level}", "score"=>40}, {"value"=>"${details.anonymousNetwork.level}", "score"=>60}, {"value"=>"${details.ipRisk.level}", "score"=>40}], "between"=>{"minScore"=>900, "maxScore"=>1000}}}]}
RESPONSES
status: Created
{"_links":{"self":{"href":"https://api.pingone.eu/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/riskPolicySets/f394426f-9b71-4e01-ac78-2956a2e92ac2"},"environment":{"href":"https://api.pingone.eu/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"}},"id":"f394426f-9b71-4e01-ac78-2956a2e92ac2","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"name":"Score-based policy","createdAt":"2022-07-21T06:54:42.494Z","updatedAt":"2022-07-21T06:54:42.494Z","defaultResult":{"level":"LOW","type":"VALUE"},"riskPolicies":[{"id":"e58475bc-ae86-44fa-aabe-37fcc59390f3","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"policySet":{"id":"f394426f-9b71-4e01-ac78-2956a2e92ac2"},"name":"ANONYMOUS_NETWORK_DETECTION","priority":1,"result":{"level":"HIGH","type":"VALUE"},"condition":{"equals":true,"value":"${details.anonymousNetworkDetected}","type":"VALUE_COMPARISON"},"createdAt":"2022-07-21T06:54:42.494Z","updatedAt":"2022-07-21T06:54:42.494Z"},{"id":"bcb992d2-133b-438c-9d04-1f720a4e4011","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"policySet":{"id":"f394426f-9b71-4e01-ac78-2956a2e92ac2"},"name":"GEOVELOCITY_ANOMALY","priority":2,"result":{"level":"MEDIUM","type":"VALUE"},"condition":{"equals":true,"value":"${details.impossibleTravel}","type":"VALUE_COMPARISON"},"createdAt":"2022-07-21T06:54:42.494Z","updatedAt":"2022-07-21T06:54:42.494Z"},{"id":"70ab14c2-bfbd-4c75-8d14-e6b85fbee064","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"policySet":{"id":"f394426f-9b71-4e01-ac78-2956a2e92ac2"},"name":"Medium scored policy","priority":3,"result":{"level":"MEDIUM","type":"VALUE"},"condition":{"between":{"minScore":700,"maxScore":900},"aggregatedScores":[{"value":"${details.userLocationAnomaly.level}","score":40},{"value":"${details.anonymousNetwork.level}","score":60},{"value":"${details.ipRisk.level}","score":40}],"type":"AGGREGATED_SCORES"},"createdAt":"2022-07-21T06:54:42.494Z","updatedAt":"2022-07-21T06:54:42.494Z"},{"id":"3fabcf6f-1eb0-426b-9b1d-e448b9159866","environment":{"id":"abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"},"policySet":{"id":"f394426f-9b71-4e01-ac78-2956a2e92ac2"},"name":"High scored policy","priority":4,"result":{"level":"HIGH","type":"VALUE"},"condition":{"between":{"minScore":900,"maxScore":1000},"aggregatedScores":[{"value":"${details.userLocationAnomaly.level}","score":40},{"value":"${details.anonymousNetwork.level}","score":60},{"value":"${details.ipRisk.level}","score":40}],"type":"AGGREGATED_SCORES"},"createdAt":"2022-07-21T06:54:42.494Z","updatedAt":"2022-07-21T06:54:42.494Z"}],"default":false}