Skip to content

Commit

Permalink
feat: remove domain option for azure-active-directory-password au…
Browse files Browse the repository at this point in the history
…thentication

BREAKING CHANGE: The `domain` option was replaced by the `tenantId` option.
  • Loading branch information
arthurschreiber authored Jul 11, 2022
1 parent 438986e commit a6dc9fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ jobs:
"type": "azure-active-directory-password",
"options": {
"clientId": "${{ secrets.AZURE_AD_SP_CLIENT_ID }}",
"domain": "${{ secrets.AZURE_AD_TENANT_ID }}",
"tenantId": "${{ secrets.AZURE_AD_TENANT_ID }}",
"userName": "${{ secrets.AZURE_AD_USERNAME }}",
"password": "${{ secrets.AZURE_AD_PASSWORD }}"
}
Expand Down
18 changes: 1 addition & 17 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ import { version } from '../package.json';
import { URL } from 'url';
import { AttentionTokenHandler, InitialSqlTokenHandler, Login7TokenHandler, RequestTokenHandler, TokenHandler } from './token/handler';

let domainRenameToTenantIdWarningEmitted = false;
const emitDomainRenameToTenantIdWarning = () => {
if (!domainRenameToTenantIdWarningEmitted) {
domainRenameToTenantIdWarningEmitted = true;
process.emitWarning('`When using authentication type `azure-active-directory-password`,' +
' config.authentication.options.domain` will be renamed to config.authentications.options.tenantId`' +
' in the future. Rename `domain` to `tenantId` to silence this message.');
}
};

type BeginTransactionCallback =
/**
* The callback is called when the request to start the transaction has completed,
Expand Down Expand Up @@ -1115,12 +1105,6 @@ class Connection extends EventEmitter {
throw new TypeError('The "config.authentication.options.password" property must be of type string.');
}

if (options.domain !== undefined && typeof options.domain !== 'string') {
throw new TypeError('The "config.authentication.options.domain" property must be of type string.');
} else if (options.domain !== undefined) {
emitDomainRenameToTenantIdWarning();
}

if (options.tenantId !== undefined && typeof options.tenantId !== 'string') {
throw new TypeError('The "config.authentication.options.tenantId" property must be of type string.');
}
Expand All @@ -1130,7 +1114,7 @@ class Connection extends EventEmitter {
options: {
userName: options.userName,
password: options.password,
tenantId: options.tenantId ?? options.domain,
tenantId: options.tenantId,
clientId: options.clientId
}
};
Expand Down

0 comments on commit a6dc9fa

Please sign in to comment.