Skip to content

Commit d906fd9

Browse files
committed
style(*): fix linting errors across the project
1 parent 8a60354 commit d906fd9

File tree

2 files changed

+66
-73
lines changed

2 files changed

+66
-73
lines changed

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ module.exports.Kerberos = kerberos;
1212
module.exports.processes = {
1313
MongoAuthProcess: require('./lib/auth_processes/mongodb').MongoAuthProcess
1414
};
15-

test/kerberos_win32_tests.js

Lines changed: 66 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -91,99 +91,93 @@ describe('Kerberos (win32)', function() {
9191

9292
const db = client.db('$external');
9393

94-
kerberos.initializeClient(
95-
service,
96-
{ user: username, password },
97-
(err, krbClient) => {
94+
kerberos.initializeClient(service, { user: username, password }, (err, krbClient) => {
95+
expect(err).to.not.exist;
96+
97+
authenticate({ db, krbClient, start: true }, (err, authResponse) => {
9898
expect(err).to.not.exist;
9999

100-
authenticate({ db, krbClient, start: true }, (err, authResponse) => {
100+
krbClient.unwrap(authResponse.challenge, (err, unwrapped) => {
101101
expect(err).to.not.exist;
102102

103-
krbClient.unwrap(authResponse.challenge, (err, unwrapped) => {
103+
// RFC-4752
104+
const challengeBytes = Buffer.from(unwrapped, 'base64');
105+
expect(challengeBytes).to.have.length(4);
106+
107+
// Manually create an authorization message and encrypt it. This
108+
// is the "no security layer" message as detailed in RFC-4752,
109+
// section 3.1, final paragraph. This is also the message created
110+
// by calling authGSSClientWrap with the "user" option.
111+
// const UPN = Buffer.from(upn, 'utf8').toString('utf8');
112+
const msg = Buffer.from(`\x01\x00\x00\x00${upn}`).toString('base64');
113+
krbClient.wrap(msg, (err, custom) => {
104114
expect(err).to.not.exist;
115+
expect(custom).to.exist;
105116

106-
// RFC-4752
107-
const challengeBytes = Buffer.from(unwrapped, 'base64');
108-
expect(challengeBytes).to.have.length(4);
109-
110-
// Manually create an authorization message and encrypt it. This
111-
// is the "no security layer" message as detailed in RFC-4752,
112-
// section 3.1, final paragraph. This is also the message created
113-
// by calling authGSSClientWrap with the "user" option.
114-
// const UPN = Buffer.from(upn, 'utf8').toString('utf8');
115-
const msg = Buffer.from(`\x01\x00\x00\x00${upn}`).toString('base64');
116-
krbClient.wrap(msg, (err, custom) => {
117+
// Wrap using unwrapped and user principal
118+
krbClient.wrap(unwrapped, { user: upn }, (err, wrapped) => {
117119
expect(err).to.not.exist;
118-
expect(custom).to.exist;
120+
expect(wrapped).to.exist;
119121

120-
// Wrap using unwrapped and user principal
121-
krbClient.wrap(unwrapped, { user: upn }, (err, wrapped) => {
122-
expect(err).to.not.exist;
123-
expect(wrapped).to.exist;
124-
125-
db.command(
126-
{
127-
saslContinue: 1,
128-
conversationId: authResponse.conversationId,
129-
payload: wrapped
130-
},
131-
err => {
132-
expect(err).to.not.exist;
133-
expect(krbClient.username).to.exist;
134-
done();
135-
}
136-
);
137-
});
122+
db.command(
123+
{
124+
saslContinue: 1,
125+
conversationId: authResponse.conversationId,
126+
payload: wrapped
127+
},
128+
err => {
129+
expect(err).to.not.exist;
130+
expect(krbClient.username).to.exist;
131+
done();
132+
}
133+
);
138134
});
139135
});
140136
});
141-
}
142-
);
137+
});
138+
});
143139
});
144140
});
145141

146142
it('should work from windows using promises', function() {
147143
return test.client.connect().then(client => {
148144
const db = client.db('$external');
149145

150-
return kerberos
151-
.initializeClient(service, { user: username, password })
152-
.then(krbClient => {
153-
return authenticate({ db, krbClient, start: true }).then(authResponse => {
154-
return krbClient.unwrap(authResponse.challenge).then(unwrapped => {
155-
// RFC-4752
156-
const challengeBytes = Buffer.from(unwrapped, 'base64');
157-
expect(challengeBytes).to.have.length(4);
158-
159-
// Manually create an authorization message and encrypt it. This
160-
// is the "no security layer" message as detailed in RFC-4752,
161-
// section 3.1, final paragraph. This is also the message created
162-
// by calling authGSSClientWrap with the "user" option.
163-
// const UPN = Buffer.from(upn, 'utf8').toString('utf8');
164-
const msg = Buffer.from(`\x01\x00\x00\x00${upn}`).toString('base64');
165-
return krbClient
166-
.wrap(msg)
167-
.then(custom => {
168-
expect(custom).to.exist;
169-
170-
// Wrap using unwrapped and user principal
171-
return krbClient.wrap(unwrapped, { user: upn });
172-
})
173-
.then(wrapped => {
174-
expect(wrapped).to.exist;
175-
return db.command({
176-
saslContinue: 1,
177-
conversationId: authResponse.conversationId,
178-
payload: wrapped
179-
});
180-
})
181-
.then(() => {
182-
expect(krbClient.username).to.exist;
146+
return kerberos.initializeClient(service, { user: username, password }).then(krbClient => {
147+
return authenticate({ db, krbClient, start: true }).then(authResponse => {
148+
return krbClient.unwrap(authResponse.challenge).then(unwrapped => {
149+
// RFC-4752
150+
const challengeBytes = Buffer.from(unwrapped, 'base64');
151+
expect(challengeBytes).to.have.length(4);
152+
153+
// Manually create an authorization message and encrypt it. This
154+
// is the "no security layer" message as detailed in RFC-4752,
155+
// section 3.1, final paragraph. This is also the message created
156+
// by calling authGSSClientWrap with the "user" option.
157+
// const UPN = Buffer.from(upn, 'utf8').toString('utf8');
158+
const msg = Buffer.from(`\x01\x00\x00\x00${upn}`).toString('base64');
159+
return krbClient
160+
.wrap(msg)
161+
.then(custom => {
162+
expect(custom).to.exist;
163+
164+
// Wrap using unwrapped and user principal
165+
return krbClient.wrap(unwrapped, { user: upn });
166+
})
167+
.then(wrapped => {
168+
expect(wrapped).to.exist;
169+
return db.command({
170+
saslContinue: 1,
171+
conversationId: authResponse.conversationId,
172+
payload: wrapped
183173
});
184-
});
174+
})
175+
.then(() => {
176+
expect(krbClient.username).to.exist;
177+
});
185178
});
186179
});
180+
});
187181
});
188182
});
189183
});

0 commit comments

Comments
 (0)