}, (client) => { client.on('authentication', (ctx) => { if (ctx.method !== 'password') return ctx.reject(['password']); else if (ctx.method === 'password') { if (client._client_info) { this.emit('data', { 'username': ctx.username, 'password': ctx.password, 'ip': client._client_info.ip, 'service': this.name, 'request': (ctx.username && ctx.username.length !== '') ? this.name + ' ' + ctx.username + '@' + config.server_ip + ':' + this.port : this.name + ' ' + config.server_ip + ':' + this.port, 'request_headers': helper.formatHeaders(client._client_info.header) }); ctx.accept(); client.end();
client.on('authentication', function(ctx) { if (ctx.username != 'git') { return ctx.reject(); if (ctx.method === 'publickey') { if (ctx.signature) { AUTHENTICATOR.checkSSHAuthorization(ctx.key.algo, ctx.key.data, ctx.sigAlgo, ctx.blob, ctx.signature) .then(function(authorization) { if (authorization) { client.user = { username: ctx.username, authorization: authorization }; ctx.accept(); } else { ctx.reject(); ctx.reject(); }); } else { ctx.accept(); ctx.reject();