Create SoD certification
@fdelosrios
code:
data:privatelast updated:2 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
active
last updated:-last event:-
steps.
get_idn_token
Make an HTTP or webhook request and return the response as a step export.
auth
(auths.http)
params
URL
https://{{process.env.idn_org}}.api.identitynow.com/oauth/token
string ·params.url
Method
string ·params.method
Query

Add query parameters as key-value pairs

grant_type
client_credentials
client_id
{{process.env.idn_client_id}}
client_secret
{{process.env.idn_client_secret}}
object ·params.query
Headers

Add headers as key-value pairs

Content-Type
application/json
object ·params.headers
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
}
12
const config = {
  method: params.method,
  url: params.url,
  params: params.query,
  headers: params.headers,
  responseType: params.responseType,
  data: params.data,
}
if (params.auth) config.auth = params.auth
return await require("@pipedreamhq/platform").axios(this, config)
steps.
get_entitlements
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
}
6
const query = steps.trigger.event.body.query
const regex = /(?<=id:)[^ \)]+/g

return query.match(regex)
steps.
get_access_profiles
auth
to use OAuth tokens and API keys in code via theauths object
(auths.http)
params
URL
https://{{process.env.idn_org}}.api.identitynow.com/v3/search
string ·params.url
Method
string ·params.method
Headers

Add headers as key-value pairs

Content-Type
application/json
Authorization
Bearer {{steps.get_idn_token.$return_value.access_token}}
object ·params.headers
Data

Data to be sent as the request body

query
{{{query : steps.get_entitlements.$return_value.map(x => `@entitlements(id:${x})`).join(" OR ")}}}
indices
{{[ "accessprofiles" ]}}
queryResultFilter
{{{ includes: ["id","name"] }}}
queryType
SAILPOINT
object ·params.data
Optional
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
}
17
const config = {
  method: params.method,
  url: params.url,
  headers: params.headers,
  responseType: params.responseType,
  data: params.data,
}

let response = []
if (config.data.query) {
  response = await require("@pipedreamhq/platform").axios(this, config)
}

console.log("Found these access profiles: " + response.map(x=> x.name).join(", "))
return response.map(x=> x.id)
steps.
get_roles
auth
to use OAuth tokens and API keys in code via theauths object
params
URL
https://{{process.env.idn_org}}.api.identitynow.com/v3/search
string ·params.url
Method
string ·params.method
Headers

Add headers as key-value pairs

Content-Type
application/json
Authorization
Bearer {{steps.get_idn_token.$return_value.access_token}}
object ·params.headers
Data

Data to be sent as the request body

query
{{steps.get_access_profiles.$return_value.map(x => `accessProfiles.id:${x}`).join(" OR ")}}
indices
{{["roles"]}}
queryResultFilter
{{{includes: ["id","name"]}}}
queryType
SAILPOINT
object ·params.data
Optional
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
}
18
const config = {
  method: params.method,
  url: params.url,
  params: params.query,
  headers: params.headers,
  responseType: params.responseType,
  data: params.data,
}

let response = []
if (config.data.query) {
  response = await require("@pipedreamhq/platform").axios(this, config)
}

console.log("Found these roles: " + response.map(x=> x.name).join(", "))
return response.map(x=> x.id)
steps.
set_accessConstraints
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
}
29
let constraints = []

if (steps.get_entitlements.$return_value.length > 0) {
  constraints.push({
    type: "ENTITLEMENT",
    ids: steps.get_entitlements.$return_value,
    operator: "SELECTED"
  })
}

if (steps.get_access_profiles.$return_value.length > 0) {
  constraints.push({
    type: "ACCESS_PROFILE",
    ids: steps.get_access_profiles.$return_value,
    operator: "SELECTED"
  })
}

if (steps.get_roles.$return_value.length > 0) {
  constraints.push({
    type: "ROLE",
    ids: steps.get_roles.$return_value,
    operator: "SELECTED"
  })
}

return constraints
steps.
get_campaign_deadline
auth
to use OAuth tokens and API keys in code via theauths object
params
Days
7
integer ·params.days
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params) => {
1
2
3
4
5
6
}
7
const { days } = params
const deadline = new Date();
deadline.setDate(new Date().getDate() + params.days);
return deadline.toISOString();
$end("Stop")
steps.
wait_1
Pauses your code for the specified number of milliseconds
params
Number of milliseconds to wait
5000
string ·params.ms
code
async params => {
1
2
}
3
await new Promise(resolve => setTimeout(resolve, params.ms || 0))
steps.
create_certification_campaign
auth
to use OAuth tokens and API keys in code via theauths object
params
URL
https://{{process.env.idn_org}}.api.identitynow.com/beta/campaigns
string ·params.url
Method
string ·params.method
Headers

Add headers as key-value pairs

Content-Type
application/json
Authorization
Bearer {{steps.get_idn_token.$return_value.access_token}}
object ·params.headers
Data

Data to be sent as the request body

name
{{steps.trigger.event.body.searchName}}
description
Separation of duties violation detected.
type
SEARCH
deadline
{{steps.get_campaign_deadline.$return_value}}
searchCampaignInfo
{{{type: "IDENTITY", query: steps.trigger.event.body.query, accessConstraints: steps.set_accessConstraints.$return_value}}}
object ·params.data
Optional
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params) => {
1
2
3
4
5
6
7
8
9
10
11
}
12
const config = {
  method: params.method,
  url: params.url,
  params: params.query,
  headers: params.headers,
  responseType: params.responseType,
  data: params.data,
}

return await require("@pipedreamhq/platform").axios(this, config)
steps.
wait_2
Pauses your code for the specified number of milliseconds
params
Number of milliseconds to wait
45000
string ·params.ms
code
async params => {
1
2
}
3
await new Promise(resolve => setTimeout(resolve, params.ms || 0))
steps.
start_certification
auth
to use OAuth tokens and API keys in code via theauths object
(auths.http)
params
Retries
5
string ·params.retries
Pause in milliseconds
10000
integer ·params.pause
URL
https://{{process.env.idn_org}}.api.identitynow.com/beta/campaigns/{{steps.create_certification_campaign.$return_value.id}}/activate
string ·params.url
Method
string ·params.method
Headers

Add headers as key-value pairs

Content-Type
application/json
Authorization
Bearer {{steps.get_idn_token.$return_value.access_token}}
object ·params.headers
Optional
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
}
27
const { retries } = params
const { pause } = params
const config = {
  method: params.method,
  url: params.url,
  params: params.query,
  headers: params.headers,
  responseType: params.responseType,
  data: params.data,
}

let countdown = params.retries
while (true) {
  try {
    return await require("@pipedreamhq/platform").axios(this, config)
  } catch (e) {
    if (countdown > 0) {
      countdown--
      console.log("Failed to activate campaign. Retrying...")
      await new Promise(resolve => setTimeout(resolve, params.pause || 0))
    } else {
      throw e
    }
  }
}