2020-04-18 00:25:33 +00:00
|
|
|
const LDAPMiddleware = require('./LDAPMiddleware')
|
|
|
|
|
|
|
|
class LDAPLoggerMiddleware extends LDAPMiddleware {
|
|
|
|
static get services() {
|
2020-04-21 03:46:19 +00:00
|
|
|
return [...super.services, 'app', 'output', 'ldap_dn_format']
|
2020-04-18 00:25:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async test(req, res, next) {
|
|
|
|
let bind_dn = req.connection.ldap.bindDN
|
2020-04-21 03:46:19 +00:00
|
|
|
this.output.info(`${req.json.protocolOp} - as ${bind_dn ? bind_dn.format(this.ldap_dn_format) : 'N/A'} - target ${req.dn.format(this.ldap_dn_format)}`)
|
2020-04-18 00:25:33 +00:00
|
|
|
return next()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = LDAPLoggerMiddleware
|