A wrapper to adapt passport-ldapauth to apostrophe-passport
npm install passport-ldapauth-apostrophe-wrapperpassport-oauth2 from the outside.
bash
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:
`javascript
'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']
}
}
}
``