Queries regarding the usage of Microsoft.Data.SqlClient AccessTokenCallback in EFCore #3227
chidhambaram55
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
iam referring this example for accessTokenCallback implementation: reference.
Behaviour i was expecting:
My token lifetime is 24hours. For validating whether AccessToken callback changes are working fine, In the AccessTokenCallback Callback function, iam setting expiry as DateTimeOffset.UtcNow.AddMinutes(30), so that i want this method to be invoked every 30 minutes.
Behaviour noticed while testing:
During startup, when different connections are created, 60 logs are found in ConnectionOpeningAsync method. But for only some of them (around 40) AccessTokenCallback is called
After sometime, more new connections are created, due to which again few logs are found in ConnectionOpeningAsync method , due to which Access Token callback function is again invoked for some of these connections.
For same connection which is created around 1hour before, Access Token callback function is not called again even after 30 minutes is passed
Queries:
Code:
`public class AADAuthDBInterceptor : DbConnectionInterceptor
{
private readonly Func<SqlAuthenticationParameters, CancellationToken, Task> _accessTokenCallback;
private readonly ConfidentialClientAppBuilder _confidentialClientAppBuilder;
}`
Beta Was this translation helpful? Give feedback.
All reactions