1.0.0 • Published 5 years ago
passport-ldapauth-apostrophe-wrapper v1.0.0
passport-ldapauth-apostrophe-wrapper
This is a wrapper strategy based on passport-ldapauth. It adapts passport-ldapauth to apostrophe-passport.
apostrophe-passport is designed to support strategies based on passport-oauth2.
In order to use passport-ldapauth in apostrophe-passport, we should wrap it in a new strategy that looks more like passport-oauth2
from the outside.
Installation
npm install --save passport-ldapauth-apostrophe-wrapper
# if you prefer yarn
yarn add passport-ldapauth-apostrophe-wrapper
Usage
Please refer to passport-ldapauth.
This strategy adds an extra configuration option completeProfile
. The option accepts a function, whose first argument is the ldap search result, and should return the completed user profile.
Reference: How should I map users on their site to users on my site?
For more detailed usage, please refer to apostrophe-passport.
Configuration example:
'apostrophe-passport': {
strategies: [{
module: 'passport-ldapauth-apostrophe-wrapper',
options: {
server: {
url: 'ldap://localhost:389',
bindDN: 'cn=root',
bindCredentials: 'secret',
searchBase: 'ou=passport-ldapauth',
searchFilter: '(uid={{username}})'
},
completeProfile: function (user) {
user.username = user.cn
user.displayName = user.cn
return user
}
}
}],
create: {
group: {
title: 'ldap',
permissions: ['admin']
}
}
}
License
1.0.0
5 years ago