-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding external authentication capability when using oracledb driver #1716
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1e1228b
Adding external authentication capability as mentioned in https://git…
90fcd34
merge conflicts
4b3b726
Add unit test for externalAuth
81c854d
Cover the connection string part
9ccd9e3
Update documentation
b75d5c0
fix spaces
2cb04d1
Hide the fake Oracle server error
add7457
minor grammar changes and spaces changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,15 +65,23 @@ Client_Oracledb.prototype.acquireRawConnection = function() { | |
const client = this; | ||
const asyncConnection = new Promise(function(resolver, rejecter) { | ||
|
||
const oracleDbConfig = { | ||
user: client.connectionSettings.user, | ||
password: client.connectionSettings.password, | ||
connectString: client.connectionSettings.connectString || | ||
(client.connectionSettings.host + '/' + client.connectionSettings.database) | ||
} | ||
// 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 } : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 spaces too wide indentation... or below 2 spaces too narrow |
||
{ | ||
user : client.connectionSettings.user, | ||
password : client.connectionSettings.password | ||
} | ||
|
||
// In the case of external authentication connection string will be given | ||
oracleDbConfig.connectString = client.connectionSettings.connectString || | ||
(client.connectionSettings.host + '/' + client.connectionSettings.database); | ||
|
||
if (client.connectionSettings.prefetchRowCount) { | ||
oracleDbConfig.prefetchRows = client.connectionSettings.prefetchRowCount | ||
} | ||
|
||
if (!_.isUndefined(client.connectionSettings.stmtCacheSize)) { | ||
oracleDbConfig.stmtCacheSize = client.connectionSettings.stmtCacheSize; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*global it, describe, expect*/ | ||
|
||
'use strict'; | ||
var expect = require('chai').expect; | ||
var knex = require('../../../knex'); | ||
var knexInstance = knex( | ||
{ | ||
client: 'oracledb', | ||
connection: { | ||
user : "user", | ||
password : "password", | ||
connectString : 'connect-string', | ||
externalAuth : true, | ||
host : "host", | ||
database : "database" | ||
} | ||
} | ||
); | ||
var spy; | ||
|
||
beforeEach(function() { | ||
spy = sinon.spy(knexInstance.client.driver, "getConnection"); | ||
}); | ||
|
||
afterEach(function() { | ||
sinon.restore(knexInstance.client.driver.getConnection); | ||
}); | ||
|
||
describe("OracleDb externalAuth", function() { | ||
it('externalAuth and connectString should be sent to the getConnection', function() { | ||
var connectionWithExternalAuth = { | ||
connectString: "connect-string", | ||
externalAuth: true | ||
} | ||
knexInstance.client.acquireRawConnection().then( | ||
function(resolve) {}, | ||
function(reject) {} | ||
); | ||
expect(spy).to.have.callCount(1); | ||
expect(spy).to.have.been.calledWith(connectionWithExternalAuth); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... including Oracle Wallet...