-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for Access Token Authentication for SQL Server Driv…
…er (mssql) (#7477) * feat: add support for sql server authentication types * feat: revert user and password deprecation for compatibility with other drivers `options.domain` is an advanced driver-based authentication type and node-mssql fallbacks it as ntlm type. Because of that, it should be passed in the same way as other advanced authentication types in `options.authentication` object.
- Loading branch information
Showing
9 changed files
with
154 additions
and
6 deletions.
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
10 changes: 10 additions & 0 deletions
10
src/driver/sqlserver/authentication/AzureActiveDirectoryAccessTokenAuthentication.ts
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,10 @@ | ||
export interface AzureActiveDirectoryAccessTokenAuthentication { | ||
type: "azure-active-directory-access-token"; | ||
options: { | ||
/** | ||
* A user need to provide `token` which they retrived else where | ||
* to forming the connection. | ||
*/ | ||
token: string; | ||
}; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/driver/sqlserver/authentication/AzureActiveDirectoryMsiAppServiceAuthentication.ts
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,20 @@ | ||
export interface AzureActiveDirectoryMsiAppServiceAuthentication { | ||
type: "azure-active-directory-msi-app-service"; | ||
options: { | ||
/** | ||
* If you user want to connect to an Azure app service using a specific client account | ||
* they need to provide `clientId` asscoiate to their created idnetity. | ||
* | ||
* This is optional for retrieve token from azure web app service | ||
*/ | ||
clientId?: string; | ||
/** | ||
* A msi app service environment need to provide `msiEndpoint` for retriving the accesstoken. | ||
*/ | ||
msiEndpoint?: string; | ||
/** | ||
* A msi app service environment need to provide `msiSecret` for retriving the accesstoken. | ||
*/ | ||
msiSecret?: string; | ||
}; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/driver/sqlserver/authentication/AzureActiveDirectoryMsiVmAuthentication.ts
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,16 @@ | ||
export interface AzureActiveDirectoryMsiVmAuthentication { | ||
type: "azure-active-directory-msi-vm"; | ||
options: { | ||
/** | ||
* If you user want to connect to an Azure app service using a specific client account | ||
* they need to provide `clientId` asscoiate to their created idnetity. | ||
* | ||
* This is optional for retrieve token from azure web app service | ||
*/ | ||
clientId?: string; | ||
/** | ||
* A user need to provide `msiEndpoint` for retriving the accesstoken. | ||
*/ | ||
msiEndpoint?: string; | ||
}; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/driver/sqlserver/authentication/AzureActiveDirectoryPasswordAuthentication.ts
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,18 @@ | ||
export interface AzureActiveDirectoryPasswordAuthentication { | ||
type: "azure-active-directory-password"; | ||
options: { | ||
/** | ||
* A user need to provide `userName` asscoiate to their account. | ||
*/ | ||
userName: string; | ||
/** | ||
* A user need to provide `password` asscoiate to their account. | ||
*/ | ||
password: string; | ||
|
||
/** | ||
* Optional parameter for specific Azure tenant ID | ||
*/ | ||
domain: string; | ||
}; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/driver/sqlserver/authentication/AzureActiveDirectoryServicePrincipalSecret.ts
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,17 @@ | ||
export interface AzureActiveDirectoryServicePrincipalSecret { | ||
type: "azure-active-directory-service-principal-secret"; | ||
options: { | ||
/** | ||
* Application (`client`) ID from your registered Azure application | ||
*/ | ||
clientId: string; | ||
/** | ||
* The created `client secret` for this registered Azure application | ||
*/ | ||
clientSecret: string; | ||
/** | ||
* Directory (`tenant`) ID from your registered Azure application | ||
*/ | ||
tenantId: string; | ||
}; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/driver/sqlserver/authentication/DefaultAuthentication.ts
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,13 @@ | ||
export interface DefaultAuthentication { | ||
type: "default"; | ||
options: { | ||
/** | ||
* User name to use for sql server login. | ||
*/ | ||
userName?: string; | ||
/** | ||
* Password to use for sql server login. | ||
*/ | ||
password?: string; | ||
}; | ||
} |
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,19 @@ | ||
export interface NtlmAuthentication { | ||
type: "ntlm"; | ||
options: { | ||
/** | ||
* User name from your windows account. | ||
*/ | ||
userName: string; | ||
/** | ||
* Password from your windows account. | ||
*/ | ||
password: string; | ||
/** | ||
* Once you set domain for ntlm authentication type, driver will connect to SQL Server using domain login. | ||
* | ||
* This is necessary for forming a connection using ntlm type | ||
*/ | ||
domain: string; | ||
}; | ||
} |