clapper is a third-party access control plugin for hapi. clapper uses and registers bell, hapi-auth-cookie, and hapi-require-https plugins.
clapper is intended to be the only plugin you need to get simple OAuth authentication and access control working for your application.
Lead Maintainer: Ho-Fan Kang
Usage
clapper was designed to be fully functional via configuration.
clapper works by adding a global pre-handler on all incoming server requests. This handler function is used to determine whether or not the user can proceed by examining their access rights and the route's access pre-requisites.
var Hapi = ;var server = ; server; // Register clapper with the server.// This example adds facebook as one of the login providers.server;
Options
clapper requires the following plugin configuration options:
defaultRights
- an object containing the following:anonymous
- an object containing boolean properties representing an anonymous user's rights granted by default.authenticated
- an object containing boolean properties representing an authenticated user's rights granted by default.
cookie
- an object containing the hapi-auth-cookie strategy options used by clapperlogins
- an array containing at least one instance of the object defined below:displayName
- a string representing the name of the authentication provider as displayed to the userrouteName
- a unique string representing the name of the route to be created by clapper for authentication with the specified OAuth providerbellProvider
- an object containing the bell authentication strategy options used by clapperadditionalRights
- optional an object containing boolean properties representing additional rights granted to any authenticated users using this specific authentication providerplugins
- optional an array of objects where each one is either:- a plugin registration function
- an object with the following:
register
- a hapi plugin registration function.options
- optional options passed to the registration function when called.