OpenVeo server API for plugins

API Docs for: 7.0.0
Show:

Plugin

Module: plugin

Summary

Defines a base class for all plugins.

// Implement a Plugin : "MyPlugin"
var util = require('util');
var express = require('express');
var openVeoApi = require('@openveo/api');
var MyPluginApi = require('./MyPluginApi.js');

function MyPlugin() {
  MyPlugin.super_.call(this);

  // Creates public, private and Web Service HTTP routers
  this.router = express.Router();
  this.adminRouter = express.Router();
  this.webServiceRouter = express.Router();

  // Exposes MyPlugin's APIs
  this.api = new MyPluginApi();

}

MyPlugin.prototype.init = function() {
  console.log('Initialize plugin');
};

MyPlugin.prototype.start = function() {
  console.log('Start plugin');
};

util.inherits(MyPlugin, openVeoApi.plugin.Plugin);

Constructor

Plugin

Syntax

Plugin

()

Summary

Item Index

Methods

Methods

get

Provided by the passport module.

Defined in lib/passport/strategies/strategyFactory.js:17

Syntax

get

(
  • id
  • configuration
  • verify
)
Object static

Summary

Gets an instance of a passport strategy.

Parameters:

  • id String

    The id of the strategy, see require('@openveo/api').passport.STRATEGIES to find out which strategies are supported

  • configuration Object

    Strategy configuration, it depends on the strategy

  • verify Function

    Passport verify callback to validate the user authenticated by the third party provider

    • Object The user authenticated by the third party provider
    • Function Function to call when verification has been performed
      • Error An error occured during verification
      • Object The verified user
      • String Informative message about verification failure

Returns:

Object:

A passport strategy

Example:

e.g. cas strategy configuration example
// {

//   // Application service
//   "service": "https://my-application-service-host",

//   // CAS server url
//   "url": "https://my-cas-server-host:8443/cas",

//   // CAS protocol version (could be 1, 2, 3)
//   "version": "3",

//   // CAS full chain certificate if one of the CAs not in system well known CAs
//   "certificate": "/home/test/cas.crt"

//   // URI to return to when logged out
//   "logoutUri": "be"

// }

e.g. ldapauth strategy configuration example
// {

//   // The url of the LDAP server
//   "url": "ldaps://my-ldap-server-host",

//   // The LDAP attribute used by "bindDn" (default to "dn")
//   "bindAttribute": "dn",

//   // The value of the "bindAttribute" associated to the entry used to connect to the server
//   "bindDn": "cn=my-user,dc=my-ldap,dc=test",

//   // The password of the entry used to connect to the server
//   "bindPassword": "qT5gvobG2ZxYSiY2r4mt",

//   // The search base when looking for users
//   "searchBase": "ou=user,dc=my-ldap,dc=test",

//   // The search scope when looking for users (default to "sub")
//   "searchScope": "sub",

//   // The search filter to find user by name, use placeholder "{{username}}" which will be replaced
//   // by the user name when searching
//   "searchFilter": "(&(objectclass=person)(cn={{username}}))",

//   // The name of the LDAP attribute holding the group name of a user
//   "userGroupAttribute": "group",

//   // The name of the LDAP attribute holding the name of a user
//   "userNameAttribute": "cn",

//   // The name of the LDAP attribute holding the id of a user
//   "userIdAttribute": "dn",

//   // The name of the LDAP attribute holding the email of a user
//   "userEmailAttribute": "email",

//   // The absolute path of the LDAP server certificate full chain if root CA is not
//   // in the Node.JS well known CAs
//   "certificate": "/absolute/path/to/cert/ldap.crt",

//   // The name of the field in the authenticate request which will hold the user name
//   "usernameField": "login",

//   // The name of the field in the authenticate request which will hold the user name
//   "passwordField": "password"

// }

e.g. local strategy configuration example
// {

//   // The name of the field in the authenticate request which will hold the user name
//   "usernameField": "login",

//   // The name of the field in the authenticate request which will hold the user password
//   "passwordField": "password"

// }

init

Syntax

init

(
  • callback
)
async

Summary

Offers the possibility to initialize the plugin.

A plugin may want, for example, to use this method to create indexes for its collections.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise

start

Syntax

start

(
  • callback
)
async

Summary

Indicates that the plugin is fully loaded in application process and can be started.

Parameters:

  • callback Function

    Function to call when it's done with :

    • Error An error if something went wrong, null otherwise