CoreID/app/ldap/middleware/Logger.middleware.js

16 lines
561 B
JavaScript
Raw Permalink Normal View History

2020-04-18 00:25:33 +00:00
const LDAPMiddleware = require('./LDAPMiddleware')
class LDAPLoggerMiddleware extends LDAPMiddleware {
static get services() {
2020-05-04 01:16:54 +00:00
return [...super.services, 'app', 'output', 'configs']
2020-04-18 00:25:33 +00:00
}
async test(req, res, next) {
let bind_dn = req.connection.ldap.bindDN
2020-05-04 01:16:54 +00:00
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'))}`)
2020-04-18 00:25:33 +00:00
return next()
}
}
module.exports = exports = LDAPLoggerMiddleware