URL hit tracking plugin for Hapi


ACL plugin for Hapi

  • tagprefix - String; Defaults to acl
  • request - String; Defaults to auth.credentials. Can be dot notation or a single string
  • tags - Array(String); Defaults to ['auditors', 'admins']
  • validation - Object
    • auditors - Object
      • auditor - Defaults to a boolean value (true)
    • admins - Object
      • admin - Defaults to a boolean value (true)

This example expects the request to resolve request.auth.credentials to an object with the following:

    auditorFor: ['TEST1', 'TEST2'],
    adminFor: ['TEST3', 'TEST4']

The cooresponding plugin configuration:

  tagprefix: 'acl',
  request: 'auth.credentials',
  tags: ['auditors', 'admins'],
  validation: {
    'auditors': {
       'auditorFor':  ['TEST1', 'TEST2']
    'admins': {
       'adminFor': ['TEST3', 'TEST4']

The plugin builds strings in the form of tagprefix + tags[n] and then searches request.route.tags for matching entries. If a match is found, a validation test happens where the request.auth.credentials is checked for auditorFor to contain either 'TEST1' or 'TEST2'