File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ var Query = require('./query')
10
10
var defaults = require ( './defaults' )
11
11
var Connection = require ( './connection' )
12
12
const crypto = require ( './crypto/utils' )
13
+ const kerberos = require ( 'kerberos' ) . Kerberos
13
14
14
15
class Client extends EventEmitter {
15
16
constructor ( config ) {
@@ -20,6 +21,7 @@ class Client extends EventEmitter {
20
21
this . database = this . connectionParameters . database
21
22
this . port = this . connectionParameters . port
22
23
this . host = this . connectionParameters . host
24
+ this . principal = this . connectionParameters . principal
23
25
24
26
// "hiding" the password so it doesn't show up in stack traces
25
27
// or if the client is console.logged
@@ -204,8 +206,7 @@ class Client extends EventEmitter {
204
206
205
207
async _handleGSSInit ( msg ) {
206
208
try {
207
- // TODO: Below needs to be parameterized
208
- this . client = await kerberos . initializeClient ( 'postgres@pg.US-WEST-2.COMPUTE.INTERNAL' , {
209
+ this . client = await kerberos . initializeClient ( `${ this . principal } @${ this . host } ` , {
209
210
mechOID : kerberos . GSS_MECH_OID_SPNEGO ,
210
211
} )
211
212
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ class ConnectionParameters {
65
65
66
66
this . port = parseInt ( val ( 'port' , config ) , 10 )
67
67
this . host = val ( 'host' , config )
68
+ // Kerberos/GSSAPI service principal
69
+ this . principal = val ( 'principal' , config )
68
70
69
71
// "hiding" the password so it doesn't show up in stack traces
70
72
// or if the client is console.logged
You can’t perform that action at this time.
0 commit comments