Module: passport/strategyFactory

Gets an instance of a passport strategy.

Have a look at STRATEGIES to find out which passport strategies are supported.

Source:

Methods

(static) get(id, configuration, verify) → {Object}

Gets an instance of a passport strategy.

Parameters:
Name Type Description
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
Source:
Returns:

A passport strategy

Type
Object
Examples
// 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"

// }
// 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"

// }
// 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"

// }