mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
25 lines
597 B
JavaScript
25 lines
597 B
JavaScript
|
|
module.exports = Plugin
|
|
|
|
function Plugin(config, stuff) {
|
|
var self = Object.create(Plugin.prototype)
|
|
self._config = config
|
|
return self
|
|
}
|
|
|
|
// plugin is expected to be compatible with...
|
|
Plugin.prototype.verdaccio_version = '1.1.0'
|
|
|
|
Plugin.prototype.authenticate = function(user, password, cb) {
|
|
var self = this
|
|
if (user !== self._config.accept_user) {
|
|
// delegate to next plugin
|
|
return cb(null, false)
|
|
}
|
|
if (password !== self._config.with_password) {
|
|
var err = Error("i don't like your password")
|
|
err.status = 403
|
|
return cb(err)
|
|
}
|
|
return cb(null, [ user ])
|
|
}
|