Adding external authentication capability when using oracledb driver #1716

Merged
merged 8 commits into from Nov 30, 2016

Projects

None yet

3 participants

@nixgadget
Contributor

Adding external authentication capability as mentioned in https://github.com/oracle/node-oracledb/blob/master/doc/api.md#extauth

@nixgadget
Contributor

What does it take to merge these changes upstream ?

@elhigu

In addition to just passing different auth setting, also an unit test should be written, which creates knex instance with externalAuth param and test should check that configuration doesn't have user / password set in that case. Logging in with username / password is already tested in integration tests. Also tests should be fixed... problem with failures did seem to be just linting errors.

Lastly some kind of documentation/example of the new feature would be good to have.

src/dialects/oracledb/index.js
+ const oracleDbConfig = {};
+
+ // If external authentication dont have to worry about username/password
+ if (client.connectionSettings.externalAuth) {
@elhigu
elhigu Nov 9, 2016 Collaborator

This should be the same but more readable:

const oracleDbConfig = client.connectionSettings.externalAuth ?
  { externalAuth : client.connectionSettings.externalAuth } :
  {
     user : client.connectionSettings.user,
     password: client.connectionSettings.password
  };
src/dialects/oracledb/index.js
}
+
+ // In the case of external authentication connection string will be given
+ if (client.connectionSettings.connectString){
@elhigu
elhigu Nov 9, 2016 Collaborator

Here the original style

oracleDbConfig.connectString = client.connectionSettings.connectString ||
  (client.connectionSettings.host + '/' + client.connectionSettings.database);

is easier to read and understand.

@xudingding978

Hi, I did the changes you mentioned in the previous comment.
And the tests are failing at the "npm run babel" step, and mysql part.

@elhigu
Collaborator
elhigu commented Nov 29, 2016

Thanks. Yeah, all builds has been annoyingly semi-random-pretty-much-always failing for some time. I'll look to the random fails and afterwards I'll review this one again.

README.md
@@ -8,7 +8,7 @@
> **A SQL query builder that is _flexible_, _portable_, and _fun_ to use!**
-A batteries-included, multi-dialect (MSSQL, MySQL, PostgreSQL, SQLite3, WebSQL, Oracle) query builder for
+A batteries-included, multi-dialect (MSSQL, MySQL, PostgreSQL, SQLite3, Oracle(include Oracle Wallet Authentication), WebSQL) query builder for
@elhigu
elhigu Nov 29, 2016 Collaborator

... including Oracle Wallet...

src/dialects/oracledb/index.js
+ // If external authentication dont have to worry about username/password and
+ // if not need to set the username and password
+ const oracleDbConfig = client.connectionSettings.externalAuth ?
+ { externalAuth : client.connectionSettings.externalAuth } :
@elhigu
elhigu Nov 29, 2016 edited Collaborator

2 spaces too wide indentation... or below 2 spaces too narrow

@elhigu
elhigu approved these changes Nov 29, 2016 View changes
@elhigu
Collaborator
elhigu commented Nov 30, 2016

Looks good now, thanks! I added separate issue to documentation branch about documenting all the supported oracledb driver parameters.

@elhigu elhigu merged commit da5ed96 into tgriesser:master Nov 30, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment