Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
passport-activedirectory
Advanced tools
Active Directory strategy for passport.js
This Strategy is a "fork" of passport-windowsauth
that uses the activedirectory
module instead of directly calling ldapjs
.
The module works almost identically except that the verify
function is passed the ActiveDirectory
object as a parameter so that you can use the query functions included in activedirectory
during verification. This is useful when using nested AD groups where you want to identify if a user is a member of a root level group.
var passport = require('passport')
var ActiveDirectoryStrategy = require('passport-activedirectory')
passport.use(new ActiveDirectoryStrategy({
integrated: false,
ldap: {
url: 'ldap://my.domain.com',
baseDN: 'DC=my,DC=domain,DC=com',
username: 'readuser@my.domain.com',
password: 'readuserspassword'
}
}, function (profile, ad, done) {
ad.isUserMemberOf(profile._json.dn, 'AccessGroup', function (err, isMember) {
if (err) return done(err)
return done(null, profile)
})
}))
var opts = { failWithError: true }
app.post('/login', passport.authenticate('ActiveDirectory', opts), function(req, res) {
res.json(req.user)
}, function (err) {
res.status(401).send('Not Authenticated')
})
// example request
// > curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost/login
activedirectory
var passport = require('passport')
var ActiveDirectoryStrategy = require('passport-activedirectory')
var ActiveDirectory = require('activedirectory')
var ad = new ActiveDirectory({
url: 'ldap://my.domain.com',
baseDN: 'DC=my,DC=domain,DC=com',
username: 'readuser@my.domain.com',
password: 'readuserspassword'
})
passport.use(new ActiveDirectoryStrategy({
integrated: false,
ldap: ad
}, function (profile, ad, done) {
ad.isUserMemberOf(profile._json.dn, 'AccessGroup', function (err, isMember) {
if (err) return done(err)
return done(null, profile)
})
}))
options
, verify
)options
{ Object
} - Options for connecting and verification
integrated=true
] { Boolean
} - Use windows integrated login. For username and password authentication set this to false
passReqToCallback=false
] { Boolean
} - Pass the request to the callbackusernameField="username"
] { String
} - request body field to use for the usernamepasswordField="password"
] { String
} - request body field to use for the passwordmapProfile
] { Function
} - Custom profile mapping function. Takes user object as only parameter and returns a profile object. _json
is added to the object with the full objectldap
] { Object
| ActiveDirectory
} - LDAP connection object. Extended properties are documented here. You may also supply an instance of activedirectory
instead.
url
{ String
} - LDAP URL (e.g. ldap://my.domain.com
)baseDN
{ String
} - Base LDAP DN to search for users inusername
{ String
} - User name of account with access to search the directorypassword
{ String
} - Password for usernamefilter
] { Function
} - Takes username
as its only parameter and returns an ldap query for that userattributes
] { Array
} - Array of attributes to include in the profile under the profile._json
key. The dn
property is always added because it is used to authenticate the userverify
{ Function
} - Verification function. Depending on the options supplied the signature will be one of the following
verify ( profile, ad, done )
- Using ldapverify( req, profile, ad, done )
- Using ldap and with the passReqToCallback
option set to true
verify ( profile, done )
- Not using ldapverify ( req, profile, done )
- Not using ldap and with the passReqToCallback
option set to true
profile
{ Object
} - User profile objectreq
{ Object
} - request objectad
{ Object
} - ActiveDirectory
instancedone
{ Function
} - Passport callbackpassport-windowsauth
activedirectory
FAQs
Active Directory strategy for passport.js
The npm package passport-activedirectory receives a total of 344 weekly downloads. As such, passport-activedirectory popularity was classified as not popular.
We found that passport-activedirectory demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.