You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A: The library handles token expiration automatically. Tokens are refreshed when they reach 70% of their lifetime (configurable via `ExpirationRefreshRatio`). You can customize this behavior using `TokenManagerOptions`.
651
+
A: The library handles token expiration automatically. Tokens are refreshed when they reach 70% of their lifetime (configurable via `ExpirationRefreshRatio`). You can also set a minimum time before expiration to trigger refresh using `LowerRefreshBound`. The token manager will automatically handle token refresh and caching.
652
+
653
+
### Q: How do I handle connection failures?
654
+
A: The library includes built-in retry mechanisms in the TokenManager. You can configure retry behavior using `RetryOptions`:
A: The library will retry according to the configured `RetryOptions`. If all retries fail, the error will be propagated to the client. You can customize the retry behavior by:
670
+
1. Setting the maximum number of attempts
671
+
2. Configuring the initial and maximum delay between retries using `time.Duration` values
672
+
3. Setting the backoff multiplier for exponential backoff
673
+
4. Providing a custom function to determine which errors are retryable
674
+
675
+
### Q: How do I implement custom authentication?
676
+
A: You can create a custom identity provider by implementing the `IdentityProvider` interface:
677
+
```go
678
+
typeIdentityProviderinterface {
679
+
// RequestToken requests a token from the identity provider.
680
+
// It returns the token, the expiration time, and an error if any.
681
+
RequestToken() (IdentityProviderResponse, error)
682
+
}
683
+
```
684
+
685
+
The `IdentityProviderResponse` interface provides methods to access the authentication result:
686
+
```go
687
+
typeIdentityProviderResponseinterface {
688
+
// Type returns the type of the auth result
689
+
Type() string
690
+
AuthResult() public.AuthResult
691
+
AccessToken() azcore.AccessToken
692
+
RawToken() string
693
+
}
694
+
```
695
+
696
+
### Q: Can I customize how token responses are parsed?
697
+
A: Yes, you can provide a custom `IdentityProviderResponseParser` in the `TokenManagerOptions`. This allows you to handle custom token formats or implement special parsing logic.
635
698
636
699
### Q: What's the difference between managed identity types?
637
700
A: There are three main types of managed identities in Azure:
@@ -664,57 +727,4 @@ A: There are three main types of managed identities in Azure:
664
727
The choice between these types depends on your specific use case:
665
728
- Use System Assigned for single-resource applications
666
729
- Use User Assigned for shared identity scenarios
667
-
- Use Default Azure Identity for development and testing
668
-
669
-
### Q: How do I handle connection failures?
670
-
A: The library includes built-in retry mechanisms in the TokenManager. You can configure retry behavior using `RetryOptions`:
671
-
```go
672
-
RetryOptions: manager.RetryOptions{
673
-
MaxAttempts: 3,
674
-
InitialDelayMs: 1000,
675
-
MaxDelayMs: 30000,
676
-
BackoffMultiplier: 2.0,
677
-
}
678
-
```
679
-
680
-
### Q: Does this work with Redis Cluster?
681
-
A: Yes, the library works with both standalone Redis and Redis Cluster. Use the appropriate Redis client constructor:
0 commit comments