Skip to content

Commit ef0fb98

Browse files
committed
Add external authentication doc
1 parent 20ac1fb commit ef0fb98

File tree

1 file changed

+101
-26
lines changed

1 file changed

+101
-26
lines changed

doc/api.md

Lines changed: 101 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ limitations under the License.
3232
- 3.2 [Oracledb Properties](#oracledbproperties)
3333
- [connectionClass](#propdbconclass)
3434
- [isAutoCommit](#propdbisautocommit)
35+
- [isExternalAuth](#propdbisexternalauth)
3536
- [maxRows](#propdbmaxrows)
3637
- [outFormat](#propdboutformat)
3738
- [poolIncrement](#propdbpoolincrement)
@@ -279,10 +280,24 @@ If this property is *true*, then the transaction in the current
279280
connection is automatically committed at the the end of statement
280281
execution.
281282

282-
The default value is false.
283+
The default value is *false*.
283284

284285
This property may be overridden in an `execute()` call.
285286

287+
<a name="propdbisexternalauth"></a>
288+
```
289+
Boolean isExternalAuth
290+
```
291+
292+
If this property is *true* then connections are established using
293+
external authentication. See [External Authentication](#extauth) for
294+
more information.
295+
296+
The default value is *false*.
297+
298+
The `user` and `password` properties for connecting or creating a pool
299+
should not be set when `isExternalAuth` is *true*.
300+
286301
<a name="propdbmaxrows"></a>
287302
```
288303
Number maxRows
@@ -438,18 +453,6 @@ ignored.
438453

439454
The properties of the `poolAttrs` object are described below.
440455

441-
```
442-
String connectString
443-
```
444-
445-
The Oracle database instance to connect to. The string can be an Easy
446-
Connect string, or a Connect Name from a `tnsnames.ora` file, or the
447-
name of a local Oracle database instance. See
448-
[Connection Strings](#connectionstrings) for examples.
449-
450-
If `connectString` is not specified, the empty string "" is used which
451-
indicates to connect to the local, default database.
452-
453456
```
454457
String user
455458
```
@@ -466,6 +469,28 @@ String password
466469
The password of the database user. A password is also necessary if a
467470
proxy user is specified.
468471

472+
```
473+
String connectString
474+
```
475+
476+
The Oracle database instance to connect to. The string can be an Easy
477+
Connect string, or a Connect Name from a `tnsnames.ora` file, or the
478+
name of a local Oracle database instance. See
479+
[Connection Strings](#connectionstrings) for examples.
480+
481+
```
482+
Boolean isExternalAuth
483+
```
484+
485+
If this optional property is *true* then the pool's connections will
486+
be established using [External Authentication](#extauth).
487+
488+
This property overrides the *Oracledb*
489+
[`isExternalAuth`](#propdbisexternalauth) property.
490+
491+
The `user` and `password` properties should not be set when
492+
`isExternalAuth` is *true*.
493+
469494
```
470495
Number stmtCacheSize
471496
```
@@ -568,18 +593,6 @@ are ignored.
568593

569594
The properties of the `connAttrs` object are described below.
570595

571-
```
572-
String connectString
573-
```
574-
575-
The Oracle database instance to connect to. The string can be an Easy Connect string, or a
576-
Connect Name from a `tnsnames.ora` file, or the name of a local
577-
Oracle database instance. See
578-
[Connection Strings](#connectionstrings) for examples.
579-
580-
If `connectString` is not specified, the empty string "" is used which
581-
indicates to connect to the local, default database.
582-
583596
```
584597
String user
585598
```
@@ -596,6 +609,28 @@ String password
596609
The password of the database user. A password is also necessary if a
597610
proxy user is specified.
598611

612+
```
613+
String connectString
614+
```
615+
616+
The Oracle database instance to connect to. The string can be an Easy Connect string, or a
617+
Connect Name from a `tnsnames.ora` file, or the name of a local
618+
Oracle database instance. See
619+
[Connection Strings](#connectionstrings) for examples.
620+
621+
```
622+
Boolean isExternalAuth
623+
```
624+
625+
If this optional property is *true* then the connection will be
626+
established using [External Authentication](#extauth).
627+
628+
This optional property overrides the *Oracledb*
629+
[`isExternalAuth`](#propdbisexternalauth) property.
630+
631+
The `user` and `password` properties should not be set when
632+
`isExternalAuth` is *true*.
633+
599634
```
600635
Number stmtCacheSize
601636
```
@@ -1161,6 +1196,9 @@ If a Connect Name from a `tnsnames.ora` file is used, set the
11611196
is read. Alternatively make sure the name is in
11621197
`$ORACLE_HOME/network/admin/tnsnames.ora` or `/etc/tnsnames.ora`.
11631198

1199+
If `connectString` is not specified, the empty string "" is used which
1200+
indicates to connect to the local, default database.
1201+
11641202
### <a name="drcp"></a> 6.2 Database Resident Connection Pooling
11651203

11661204
[Database Resident Connection Pooling](http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS228)
@@ -1206,6 +1244,43 @@ This paper also gives more detail on configuring DRCP.
12061244

12071245
### <a name="extauth"></a> 6.3 External Authentication
12081246

1247+
Instead of specifying a user and password at connection, Oracle
1248+
Database allows applications to use an external password store (such
1249+
as
1250+
[Oracle Wallet](http://docs.oracle.com/database/121/DBIMI/to_dbimi10236_d209.htm#DBIMI10236)),
1251+
the [Secure Socket Layer](http://docs.oracle.com/database/121/DBSEG/asossl.htm#DBSEG070)
1252+
(SSL), or the
1253+
[operating system](http://docs.oracle.com/database/121/DBSEG/authentication.htm#DBSEG30035)
1254+
to validate user access. This mode of authentication is called
1255+
*external authentication*. One of the benefits is that database
1256+
credentials do not need to be hard coded in the application.
1257+
1258+
To use external authentication, set the *Oracledb*
1259+
[`isExternalAuth`](propdbextauth) property to *true*. Once this is
1260+
set, any subsequent connections obtained using the *Oracledb*
1261+
[`getConnection()`](#getconnectiondb) or *Pool*
1262+
[`getConnection()`](#getconnectionpool) calls will use external
1263+
authentication. Setting this property does not affect the operation
1264+
of existing connections or pools.
1265+
1266+
When `isExternalAuth` is *true*, the `user` and `password` properties
1267+
should not be set, or should be empty strings.
1268+
1269+
The `isExternalAuth` property can be overridden in the `connAttrs` or
1270+
`poolAttrs` parameters of the *Oracledb*
1271+
[`getConnection()`](#getconnectiondb) or [`createPool()`](#createpool)
1272+
calls, respectively. Overriding `isExternalAuth` is not possible for
1273+
a *Pool* `getConnection()` call. The connections from a *Pool* object
1274+
are always obtained in the manner in which the pool was initially
1275+
created.
1276+
1277+
For pools created with external authentication, the number of
1278+
connections initially created is zero even if a non-zero value is
1279+
specified for the [`poolMin`](#propdbpoolmin). However, once the
1280+
number of open connections exceeds `poolMin` and connections are idle
1281+
for more than the [`poolTimeout`](#propdbpooltimeout) seconds, then
1282+
the number of open connections does not fall below `poolMin`.
1283+
12091284
## <a name="sqlexecution"></a> 7. SQL Execution
12101285

12111286
A SQL or PL/SQL statement may be executed using the *Connection*
@@ -1307,7 +1382,7 @@ Query result type mappings for Oracle Database types to JavaScript types are:
13071382
Node-oracledb uses the
13081383
[Oracle OCI statement cache](https://docs.oracle.com/database/121/LNOCI/oci09adv.htm#i471377)
13091384
which manages a cache of statements for each session. In the database
1310-
server, statement caching lets cursors be used without reparsing the
1385+
server, statement caching lets cursors be used without re-parsing the
13111386
statement. This eliminates repetitive statement parsing and reduces
13121387
meta data transfer costs between the driver and the database. This
13131388
improve performance and scalability.

0 commit comments

Comments
 (0)