Azure / azure-sdk

This is the Azure SDK parent repository and mostly contains documentation around guidelines and policies as well as the releases for the various languages supported by the Azure SDK.
http://azure.github.io/azure-sdk
MIT License
486 stars 296 forks source link

Board Review: Azure Communication Services (SPOOL) - Auth - Configurable Proactive Autorefresh Interval (.NET, JS/TS, Java & Python) #3712

Closed petrsvihlik closed 2 years ago

petrsvihlik commented 2 years ago

Contacts and Timeline

About the Service

Note: The changes we are introducing are not related related to any specific service. They reside in the common library (a shared lib used by all ACS modalities). The behavior we are modifying is called "proactive token autorefresh" and it's documented here: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-common#create-a-credential-with-proactive-refreshing

About the client library

Artifacts

.NET

Java

Python

TypeScript

The change

Champion Scenario

Token Refresh Flow for Custom Teams Endpoint

The change we're introducing relates to the credential proactive autorefresh logic where, originally, this functionality was being triggered 10 minutes before the expiry of a given token. We are making this time interval configurable as it turned out, the hardcoded value might not be sufficient for all scenarios. To be more specific, here’s a scenario that one of the private preview customers ran into when using autorefresh in combination with the Custom Teams Endpoint:

We want to provide the developer with an option to align the refresh interval with MSAL’s cache times. We're also changing the default refresh interval to 4.5 minutes before token expiry. MSAL's offset is 5 minutes in all languages (JS, .NET, Java, Python) so this value accounts for possible clock skew and to avoid any unnecessary calls.

Considerations:

The time offset values in MSAL and ACS SDKs

Default values

Exponential retry

Documentation update

cc @jorgegarchirota

JonathanGiles commented 2 years ago

FYI - I've responded to the APIView comment in Java, but I need to understand why you don't have fluent setters here instead. Reply via APIView or message me on Teams so we can sync on this.

lilyjma commented 2 years ago

Arch Board review scheduled for 1/6/22 2-4pm PST

tg-msft commented 2 years ago

Recording[MS INTERNAL ONLY]

petrsvihlik commented 2 years ago

As per the agreement during the review meeting, we implemented a "fractional" backoff mechanism and removed the RefreshIntervalBeforeTokenExpiry property from the options bag. So we got rid of the public API changes caused by the new property.

The behavior is now the following: image

The implementation resides in the following PRs:

We still need a couple of approvals however:

petrsvihlik commented 2 years ago

obsolete -> closing