-
Notifications
You must be signed in to change notification settings - Fork 475
Add support for azure-active-directory-access-token authentication method for tedious driver #1208
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
Conversation
|
@dhensby Could you review this PR? 🙈 |
dhensby
left a comment
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.
Thanks for this @funkydev.
Please can we add tests for this, one to make sure the config is correctly constructed when passing a config object? It looks like we don't actually test this anywhere at the moment, which is a bit worrying...
Does msnodesqlv8 support AD access tokens? If so, the config there needs to be updated too.
I note that this doesn't seem to be possible to pass in via a connection string (https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-using-azure-active-directory-authentication?view=sql-server-ver15). Is that your understanding too?
|
It appears that msnodesqlv8 does not support AD access tokens (TimelordUK/node-sqlserver-v8#83) |
Exactly. Connection String does not contains any info about the access token. It's because should be generated dynamically, before the connection init, and passed as a separate parameter. Here is a link to the interface of tedious connection config:
I'll try to implement some unit tests for passing configurations. |
|
@dhensby I cannot create unit tests for that. const cfg = {
server: this.config.server,
options: Object.assign({
encrypt: typeof this.config.encrypt === 'boolean' ? this.config.encrypt : true,
trustServerCertificate: typeof this.config.trustServerCertificate === 'boolean' ? this.config.trustServerCertificate : false
}, this.config.options),
authentication: Object.assign({
type: (
(this.config.token !== undefined && 'azure-active-directory-access-token') ||
(this.config.domain !== undefined && 'ntlm') ||
'default'
),
options: {
userName: this.config.user,
password: this.config.password,
domain: this.config.domain,
token: this.config.token
}
}, this.config.authentication)
}Anyway, I can see that the library accepts const connectionPool = new ConnectionPoool({
// ... other settings
authentication: {
type: 'azure-active-directory-access-token',
options: {
token: 'automatically-generated-token'
}
}
}) |
|
@funkydev - that's right, you can pass your own authentication object; so maybe we don't need this? But perhaps an update to the docs as an example of adding "custom auth" would be good? |
This change allows to use
azure-active-directory-access-tokenauthentication method whentokenvalue would be passed in theoptionsobject.It is required to implement authenticating to the MSSQL database using Access Token.
Here is a link to the Microsoft Documentation about AD Access Token:
https://docs.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure?tabs=azure-powershell#azure-ad-token