GuardianManager

GuardianManager

Abstracts interaction with the Guardian endpoint.

Constructor

new GuardianManager(options)

Source:
Parameters:
Name Type Description
options object

The client options.

Name Type Attributes Description
baseUrl string

The URL of the API.

headers object <optional>

Headers to be included in all requests.

retry object <optional>

Retry Policy Config

Members

enrollments :external:RestClient

Provides an abstraction layer for retrieving Guardian enrollments.

Source:
Type:

factors :external:RestClient

Provides an abstraction layer for retrieving Guardian factors.

Source:
Type:

factorSettings :external:RestClient

Provides an abstraction layer for configuring Factor settings

Source:
Type:

factorsPhoneMessageTypes :external:RestClient

Provides an abstraction layer for retrieving Guardian phone factor message types.

Source:
Type:

factorsPhoneSelectedProvider :external:RestClient

Provides an abstraction layer for retrieving Guardian phone factor selected provider.

Source:
Type:

factorsProviders :external:RestClient

Provides an abstraction layer for retrieving Guardian factor providers.

Source:
Type:

factorsTemplates :external:RestClient

Provides an abstraction layer for retrieving Guardian factor templates.

Source:
Type:

policies :external:RestClient

Provides an abstraction layer for retrieving Guardian policies.

Source:
Type:

tickets :external:RestClient

Provides an abstraction layer for retrieving Guardian tickets.

Source:
Type:

Methods

createEnrollmentTicket(cbopt) → {Promise|undefined}

Create a Guardian enrollment ticket.

Source:
Parameters:
Name Type Attributes Description
cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.createEnrollmentTicket(function (err, ticket) {
  console.log(ticket);
});

deleteGuardianEnrollment(data, cbopt) → {Promise|undefined}

Delete a Guardian enrollment.

Source:
Parameters:
Name Type Attributes Description
data object

The user data object.

Name Type Description
id string

The user id.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.deleteGuardianEnrollment({ id: ENROLLMENT_ID }, function (err, enrollments) {
  console.log(enrollments);
});

getFactorProvider(params, cbopt) → {Promise|undefined}

Get Guardian factor provider configuration

Source:
Parameters:
Name Type Attributes Description
params object

Factor provider parameters.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getFactorProvider({ name: 'sms', provider: 'twilio'}, function (err, provider) {
  console.log(provider);
});

getFactors(cbopt) → {Promise|undefined}

Get a list of factors and statuses.

Source:
Parameters:
Name Type Attributes Description
cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getFactors(function (err, factors) {
  console.log(factors.length);
});

getFactorSettings(params, cbopt) → {Promise|undefined}

Get Guardian factor configuration

Source:
Parameters:
Name Type Attributes Description
params object

Factor parameters.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getFactorSettings({ name: 'webauthn-roaming' }, function (err, settings) {
  console.log(settings);
});

getFactorTemplates(params, cbopt) → {Promise|undefined}

Get Guardian enrollment and verification factor templates

Source:
Parameters:
Name Type Attributes Description
params object

Factor parameters.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getFactorTemplates({ name: 'sms' }, function (err, templates) {
  console.log(templates);
});

getGuardianEnrollment(data, cbopt) → {Promise|undefined}

Get a single Guardian enrollment.

Source:
Parameters:
Name Type Attributes Description
data object

The user data object.

Name Type Description
id string

The user id.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getGuardianEnrollment({ id: ENROLLMENT_ID }, function (err, enrollment) {
  console.log(enrollment);
});

getPhoneFactorMessageTypes(cbopt) → {Promise|undefined}

Get the Guardian phone factor's message types

Source:
Parameters:
Name Type Attributes Description
cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getPhoneFactorMessageTypes(function (err, messageTypes) {
  console.log(messageTypes);
});

getPhoneFactorSelectedProvider(cbopt) → {Promise|undefined}

Get the Guardian phone factor's selected provider

Source:
Parameters:
Name Type Attributes Description
cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getPhoneFactorSelectedProvider(function (err, selectedProvider) {
  console.log(selectedProvider);
});

getPolicies(cbopt) → {Promise|undefined}

Get enabled Guardian policies

Source:
Parameters:
Name Type Attributes Description
cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.getPolicies(function (err, policies) {
  console.log(policies);
});

updateFactor(params, data, cbopt) → {Promise|undefined}

Update Guardian Factor

Source:
Parameters:
Name Type Attributes Description
params object

Factor parameters.

data object

Updated factor data.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updateFactor({ name: 'sms' }, {
  enabled: true
}, function (err, factor) {
  console.log(factor);
});

updateFactorProvider(params, data, cbopt) → {Promise|undefined}

Update Guardian's factor provider

Source:
Parameters:
Name Type Attributes Description
params object

Factor provider parameters.

data object

Updated Factor provider data.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updateFactorProvider({ name: 'sms', provider: 'twilio' }, {
  messaging_service_sid: 'XXXXXXXXXXXXXX',
  auth_token: 'XXXXXXXXXXXXXX',
  sid: 'XXXXXXXXXXXXXX'
}, function (err, provider) {
  console.log(provider);
});

updateFactorSettings(params, cbopt) → {Promise|undefined}

Update Guardian factor configuration

Source:
Parameters:
Name Type Attributes Description
params object

Factor parameters.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updateFactorSettings(
 { name: 'webauthn-roaming' },
 { userVerification: 'discouraged', overrideRelyingParty: false },
 function (err, settings) {
  console.log(settings);
});

updateFactorTemplates(params, data, cbopt) → {Promise|undefined}

Update Guardian enrollment and verification factor templates

Source:
Parameters:
Name Type Attributes Description
params object

Factor parameters.

data object

Updated factor templates data.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updateFactorProvider({ name: 'sms' }, {
  enrollment_message: "{{code}} is your verification code for {{tenant.friendly_name}}. Please enter this code to verify your enrollment.",
  verification_message: "{{code}} is your verification code for {{tenant.friendly_name}}"
}, function (err, templates) {
  console.log(templates);
});

updatePhoneFactorMessageTypes(params, data, cbopt) → {Promise|undefined}

Update the Guardian phone factor's message types

Source:
Parameters:
Name Type Attributes Description
params object

Parameters.

data object

Updated selected provider data.

Name Type Description
message_types Array.<string>

Message types (only "sms" and "voice" are supported).

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updatePhoneFactorMessageTypes({}, {
  message_types: ['sms', 'voice']
}, function (err, factor) {
  console.log(factor);
});

updatePhoneFactorSelectedProvider(params, data, cbopt) → {Promise|undefined}

Update the Guardian phone factor's selected provider

Source:
Parameters:
Name Type Attributes Description
params object

Parameters.

data object

Updated selected provider data.

Name Type Description
provider string

Name of the selected provider

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updatePhoneFactorSelectedProvider({}, {
  provider: 'twilio'
}, function (err, factor) {
  console.log(factor);
});

updatePolicies(params, data, cbopt) → {Promise|undefined}

Update enabled Guardian policies

Source:
Parameters:
Name Type Attributes Description
params object

Parameters.

data Array.<string>

Policies to enable. Empty array disables all policies.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.guardian.updatePolicies({}, [
  'all-applications'
], function (err, policies) {
  console.log(policies);
});