File tree 4 files changed +52
-7
lines changed
4 files changed +52
-7
lines changed Original file line number Diff line number Diff line change @@ -466,11 +466,10 @@ class ThinConnectionImpl extends ConnectionImpl {
466
466
* @return {Promise }
467
467
*/
468
468
async connect ( params ) {
469
- if ( params . password === undefined && params . token === undefined ) {
470
- errors . throwErr ( errors . ERR_MISSING_CREDENTIALS ) ;
471
- } else if ( ! params . connectString ) {
469
+ if ( ! params . connectString ) {
472
470
errors . throwErr ( errors . ERR_EMPTY_CONNECT_STRING ) ;
473
471
}
472
+ thinUtil . checkCredentials ( params ) ;
474
473
475
474
this . sessionID = 0 ;
476
475
this . serialNum = 0 ;
Original file line number Diff line number Diff line change @@ -32,13 +32,19 @@ const protocolUtil = require('./protocol/utils.js');
32
32
const errors = require ( '../errors.js' ) ;
33
33
const settings = require ( '../settings.js' ) ;
34
34
const util = require ( '../util.js' ) ;
35
+ const thinUtil = require ( './util.js' ) ;
35
36
const { getConnectionInfo} = require ( './sqlnet/networkSession.js' ) ;
36
37
const crypto = require ( 'crypto' ) ;
37
38
const EventEmitter = require ( 'events' ) ;
38
39
39
40
class ThinPoolImpl extends PoolImpl {
40
41
41
42
_init ( params ) {
43
+ if ( ! params . homogeneous ) {
44
+ errors . throwErr ( errors . ERR_NOT_IMPLEMENTED , 'Heterogeneous Pool' ) ;
45
+ }
46
+ thinUtil . checkCredentials ( params ) ;
47
+
42
48
this . _availableObjects = [ ] ;
43
49
this . _name = 'node-thin' ;
44
50
this . _poolMin = params . poolMin ;
Original file line number Diff line number Diff line change 27
27
'use strict' ;
28
28
29
29
const constants = require ( '../constants' ) ;
30
+ const errors = require ( '../errors.js' ) ;
30
31
31
32
//---------------------------------------------------------------------------
32
33
// getMetadataMany(sql)
@@ -260,12 +261,29 @@ function checkProxyUserValidity(userName) {
260
261
return result ;
261
262
}
262
263
264
+ //---------------------------------------------------------------------------
265
+ // checkCredentials()
266
+ //
267
+ // Check Credentials for Password Authentication
268
+ //---------------------------------------------------------------------------
269
+ function checkCredentials ( params ) {
270
+ if ( params . token === undefined ) {
271
+ if ( params . password === undefined ) {
272
+ errors . throwErr ( errors . ERR_MISSING_CREDENTIALS ) ;
273
+ }
274
+ if ( params . externalAuth === true ) {
275
+ errors . throwErr ( errors . ERR_NOT_IMPLEMENTED , 'External Auth' ) ;
276
+ }
277
+ }
278
+ }
279
+
263
280
module . exports = {
264
281
getMetadataMany,
265
282
cleanSql,
266
283
getExecuteOutBinds,
267
284
getExecuteManyOutBinds,
268
285
getOutBinds,
269
286
getBindVars,
270
- checkProxyUserValidity
287
+ checkProxyUserValidity,
288
+ checkCredentials
271
289
} ;
Original file line number Diff line number Diff line change @@ -810,9 +810,16 @@ describe('2. pool.js', function() {
810
810
homogeneous : false
811
811
} ;
812
812
delete config . user ;
813
- const pool = await oracledb . createPool ( config ) ;
814
- assert . strictEqual ( pool . homogeneous , false ) ;
815
- await pool . close ( 0 ) ;
813
+ if ( ! oracledb . thin ) {
814
+ const pool = await oracledb . createPool ( config ) ;
815
+ assert . strictEqual ( pool . homogeneous , false ) ;
816
+ await pool . close ( 0 ) ;
817
+ } else {
818
+ await assert . rejects (
819
+ async ( ) => await oracledb . createPool ( config ) ,
820
+ / N J S - 0 8 9 : /
821
+ ) ;
822
+ }
816
823
} ) ; // 2.15.11
817
824
818
825
it ( '2.15.12 user name' , async function ( ) {
@@ -864,6 +871,21 @@ describe('2. pool.js', function() {
864
871
await pool . close ( 0 ) ;
865
872
} ) ; // 2.15.14
866
873
874
+ it ( '2.15.15 externalAuth - true and non-empty password' , async function ( ) {
875
+ const config = {
876
+ connectString : dbConfig . connectString ,
877
+ poolMin : 1 ,
878
+ poolMax : 1 ,
879
+ poolIncrement : 0 ,
880
+ externalAuth : true ,
881
+ password : 'nopass'
882
+ } ;
883
+ await assert . rejects (
884
+ async ( ) => await oracledb . createPool ( config ) ,
885
+ / D P I - 1 0 3 2 : | N J S - 0 8 9 : /
886
+ ) ;
887
+ } ) ; // 2.15.15
888
+
867
889
} ) ; // 2.15
868
890
869
891
describe ( '2.16 Pool non-configurable properties global/local override' , function ( ) {
You can’t perform that action at this time.
0 commit comments