Passport-Keystone supports up to v2.x . Passport-Keystone-v3 supports up to v3.x.
Installation
npm install passport-keystone-v3
Documentation
Authentication
The keystone authentication strategy authenticates users using a username and password and optional domainName
from the POST body. The strategy requires a verify callback, which accepts these credentials and calls done
providing a user that is attached to req.user.
passport.use(newKeystoneStrategy({
authUrl:your.authUrl,// required
usernameField:'username',// optional
passwordField:'password',// optional
domainNameField:'domainName',// optional
region:your.region,// optional
tenantId:your.tenantId// optional
},
function(user,done){
var user ={
id:identity.user.id,
token:identity.token.id,
username:identity.user.name,
serviceCatalog:identity.raw.access.serviceCatalog
};
returndone(null, user);
}
));
Need to set session expiration to token expiration?
The following example uses passReqToCallback to send the req object to next callback, where session expiration
can be configured.
passport.use(newKeystoneStrategy({
authUrl:your.authUrl,// required
usernameField:'username',// optional
passwordField:'password'// optional
domainNameField:'domainName',// optional
region:your.region,// optional
tenantId:your.tenantId// optional
passReqToCallback :true// allows us to interact with req object