CoreID/app/ldap/middleware/Logger.middleware.js
2020-05-03 20:16:54 -05:00

16 lines
561 B
JavaScript

const LDAPMiddleware = require('./LDAPMiddleware')
class LDAPLoggerMiddleware extends LDAPMiddleware {
static get services() {
return [...super.services, 'app', 'output', 'configs']
}
async test(req, res, next) {
let bind_dn = req.connection.ldap.bindDN
this.output.info(`${req.json.protocolOp} - as ${bind_dn ? bind_dn.format(this.configs.get('ldap:server.format')) : 'N/A'} - target ${req.dn.format(this.configs.get('ldap:server.format'))}`)
return next()
}
}
module.exports = exports = LDAPLoggerMiddleware