Add basic LDAP bind functionality
This commit is contained in:
15
app/ldap/middleware/Logger.middleware.js
Normal file
15
app/ldap/middleware/Logger.middleware.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const LDAPMiddleware = require('./LDAPMiddleware')
|
||||
|
||||
class LDAPLoggerMiddleware extends LDAPMiddleware {
|
||||
static get services() {
|
||||
return [...super.services, 'app', 'output']
|
||||
}
|
||||
|
||||
async test(req, res, next) {
|
||||
let bind_dn = req.connection.ldap.bindDN
|
||||
this.output.info(`${req.json.protocolOp} - as ${bind_dn ? bind_dn.format({skipSpace: true}) : 'N/A'} - target ${req.dn.format({skipSpace: true})}`)
|
||||
return next()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = LDAPLoggerMiddleware
|
||||
Reference in New Issue
Block a user