2.4.2 • Published 3 years ago

@articulate/okta-profile-monitor v2.4.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

okta-profile-monitor

Small library for monitoring for user creation or user profile changes in Okta and retreiving the user's current profile data after the change.

Usage

Works by checking an S3 bucket for the current Okta log URL to query, returning up to 1000 results from Okta.

monitor

Returns a "monitor" object that will pull profile and/or group events from the system log. These events can be consumed all at once as a Promise or individually as a stream.

const { monitor } = require('@articulate/okta-profile-monitor')

const oktaToken = 'myToken'
const oktaUri = 'https://mydemo.oktapreview.com'
const bucketParams = {
  Bucket: 'myBucket',
  Key: `path/nextLogUrl.txt`,
}

const m = monitor(oktaToken, oktaUri, bucketParams, {
  groups: true,
  profiles: true,
})

Consume the events with one of the following:

m
  .promise()
  .then(messages => console.log(`Do stuff with ${messages}`))
  .catch(err => console.error('handle error', err))
  .finally(m.close)

Or

const s = m.stream()
s.on('data', message => console.log(`Do stuff with one ${message}`))
s.on('error', err => console.error('handle error', err))
s.on('end', m.close)

Params

NameTypeDescriptionRequired
oktaTokenStringAPI Token for Okta's API
oktaUriStringBase URL for your Okta Account
bucketParamsObjectAWS S3 bucket parameters to read & update the url of the next page of logs
optionsOptionsOther options

Options

NameTypeDescriptionDefault
sessionsBooleanIf true, capture user session events: user.session.startfalse
deletesBooleanIf true, capture user deleted events: user.lifecycle.delete.initiatedfalse
groupsBooleanIf true, capture group & group membership events: group.lifecycle.create, group.lifecycle.delete, group.user_membership.add, & group.user_membership.remove.false
profilesBooleanIf true, capture user profile events: user.account.update_profile, user.lifecycle.activate, user.lifecycle.create, user.lifecycle.deactivate, user.lifecycle.suspect, & user.lifecycle.unsuspendtrue

Returns

A "monitor" object.

MethodReturn TypeDescription
promisePromise [Object]Returns a Promise of all events. Will reject if any errors are encountered.
streamReadable ObjectReturns a Readable stream in object mode. Will emit each event. If errors are encountered, will emit an error event.
closeMarks the page of logs as finished. Saves the URL of the next page of logs to S3. Must be called on success.

Also implements EventEmitter. Emits the following events.

EventParametersDescrition
apicall(String description)Emitted whenever an API call is made to Okta.

main

Deprecated

Consume all profile events & pass to a callback. Functionally equivalent to calling monitor with the profile: true option.

const { main } = require('@articulate/okta-profile-monitor')

const oktaToken = 'myToken'
const oktaUri = 'https://mydemo.oktapreview.com'
const bucketParams = {
  Bucket: 'myBucket',
  Key: `path/nextLogUrl.txt`,
}

const myCallback = messages =>
  console.log(`Do stuff with ${messages}`)

main(bucketParams, oktaUri, oktaToken, myCallback)
2.4.2

3 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.8-rc1

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago