Is your feature request related to a problem? Please describe.
It's a best practice to have async methods accept and honor a cancellation token. DefaultCredentialsLoader.LoadCredentialsIfNeededAsync uses a semaphore which accepts a cancellation token. We recommend to use this certificate loader when MSAL is used to acquire tokens. The recommendation is also to recreate an MSAL instance per request and pass cancellation tokens with timeouts where accepted. This means the call to load a certificate can be called per request. So we should have an API that passes a cancellation token to the semaphore.
Describe the solution you'd like
Add an overload that accepts a cancellation token to APIs in DefaultCertificateLoader and DefaultCredentialsLoader. Pass the token to the semaphore in LoadCredentialsIfNeededAsync.
Is your feature request related to a problem? Please describe. It's a best practice to have async methods accept and honor a cancellation token. DefaultCredentialsLoader.LoadCredentialsIfNeededAsync uses a semaphore which accepts a cancellation token. We recommend to use this certificate loader when MSAL is used to acquire tokens. The recommendation is also to recreate an MSAL instance per request and pass cancellation tokens with timeouts where accepted. This means the call to load a certificate can be called per request. So we should have an API that passes a cancellation token to the semaphore.
Describe the solution you'd like Add an overload that accepts a cancellation token to APIs in DefaultCertificateLoader and DefaultCredentialsLoader. Pass the token to the semaphore in LoadCredentialsIfNeededAsync.