@@ -466,3 +466,36 @@ command is received.
466
466
>> > with r.monitor() as m:
467
467
>> > for command in m.listen():
468
468
>> > print (command)
469
+
470
+
471
+ Token-based authentication
472
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
473
+
474
+ Since redis-py version 5.3.0 new StreamableCredentialProvider interface was introduced.
475
+ This interface describes a CredentialProvider with an ability to stream an events that will be handled by listener.
476
+
477
+ To keep redis-py with minimal dependencies needed to run it, we decided to separate StreamableCredentialProvider
478
+ implementations in a separate packages. So If you're interested to try this feature please add them as a separate
479
+ dependency to your project.
480
+
481
+ `EntraIdCredentialProvider ` is a first implementation that allows you to integrate redis-py with Azure Cache for Redis
482
+ service. It will allows you to obtain a tokens from Microsoft EntraID and authenticate/re-authenticate your connections
483
+ with it in a background mode.
484
+
485
+ To get `EntraIdCredentialProvider ` you need to install following package:
486
+
487
+ `pip install redispy-entraid-credentials `
488
+
489
+ To setup a credential provider, first you have to create and configure an IdentityProvider and provide
490
+ TokenAuthConfig object.
491
+ `Here's a quick guide how to do this
492
+ <https://github.com/redis-developer/redispy-entra-credentials?tab=readme-ov-file#usage> `_
493
+
494
+ Now all you have to do is to pass an instance of `EntraIdCredentialProvider ` via constructor,
495
+ available for sync and async clients:
496
+
497
+ .. code :: python
498
+
499
+ >> > cred_provider = EntraIdCredentialProvider(auth_config)
500
+ >> > r = Redis(credential_provider = cred_provider)
501
+ >> > r.ping()
0 commit comments