Skip to content

Commit 43690a2

Browse files
authored
Acrolinx suggestions
1 parent f5e0c81 commit 43690a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/connect/ado-net/sql/azure-active-directory-authentication.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ The following example shows how to set an application client ID through a config
364364
Available in version 5.2 onwards, there's a new [AccessTokenCallback](/dotnet/api/microsoft.data.sqlclient.sqlconnection.accesstokencallback) property on [SqlConnection](/dotnet/api/microsoft.data.sqlclient.sqlconnection). Use the `AccessTokenCallback` property to define a custom function that returns an access token given the incoming parameters. Using the callback is better than using the [AccessToken](/dotnet/api/microsoft.data.sqlclient.sqlconnection.accesstoken) property because it allows the access token to be refreshed within a connection pool. When using the `AccessToken` property, the token can't be updated after opening the connection. There's also no associated expiration date provided through the property. Once the token expires, new connection requests fail with a server authentication error and pools using it must be manually cleared.
365365

366366
> [!IMPORTANT]
367-
> An `AccessTokenCallback` must return access tokens of the same security context for the same input parameters. If this is not done, pooled connections may be returned with the wrong security context for a connection.
367+
> An `AccessTokenCallback` must return access tokens of the same security context for the same input parameters. If the security context is different, a pooled connection with the wrong security context may be returned for a connection request.
368368
369369
> [!NOTE]
370-
> `AccessTokenCallback` is part of the key used to identify connection pools. Avoid creating a new function callback for every creation of a SqlConnection since that will result in a new pool every time. Reference the same instance of a function for connections you want to be considered for pooling. The connection pool key includes parameters passed to the callback and will partition connection pools appropriately.
370+
> `AccessTokenCallback` is part of the key used to identify connection pools. Avoid creating a new function callback for every creation of a SqlConnection since that results in a new pool every time. Reference the same instance of a function for connections you want to be considered for pooling. The connection pool key includes parameters passed to the callback to partition connection pools appropriately.
371371
372372
The following code snippet is an example of using the `AccessTokenCallback` property in **Microsoft.Data.SqlClient v5.2 onwards**.
373373

@@ -378,7 +378,7 @@ The following code snippet is an example of using the `AccessTokenCallback` prop
378378
Given more flexibility, the client application can also use its own provider for Microsoft Entra authentication instead of using the `ActiveDirectoryAuthenticationProvider` class. The custom authentication provider needs to be a subclass of `SqlAuthenticationProvider` with overridden methods. It then must register the custom provider, overriding one or more of the existing `Active Directory*` authentication methods.
379379

380380
> [!IMPORTANT]
381-
> An authentication provider must return access tokens of the same security context for the same input parameters. If this is not done, pooled connections may be returned with the wrong security context for a connection.
381+
> An authentication provider must return access tokens of the same security context for the same input parameters. If the security context is different, a pooled connection with the wrong security context may be returned for a connection request.
382382
383383
The following example shows how to use a new authentication provider for `Active Directory Device Code Flow` authentication.
384384

0 commit comments

Comments
 (0)