Skip to content

Revise token cache configuration API#16326

Merged
chlowell merged 13 commits intoAzure:masterfrom
chlowell:tokencache
Mar 6, 2021
Merged

Revise token cache configuration API#16326
chlowell merged 13 commits intoAzure:masterfrom
chlowell:tokencache

Conversation

@chlowell
Copy link
Copy Markdown
Member

@chlowell chlowell commented Jan 25, 2021

This PR replaces the current enable_persistent_cache and allow_unencrypted_cache keyword arguments to credentials with a new class, TokenCachePersistenceOptions, that allows the same configuration and enables an application to isolate its persistent cache from other applications.

# configuring a credential to use the default persistent cache
cache_options = TokenCachePersistenceOptions()
credential = InteractiveBrowserCredential(cache_persistence_options=cache_options)

# specify a cache name to isolate the cache from other applications
TokenCachePersistenceOptions(name="my_application")

# configure the cache to fall back to unencrypted storage when encryption isn't available
TokenCachePersistenceOptions(allow_unencrypted_storage=True)

@chlowell chlowell added Client This issue points to a problem in the data-plane of the library. Azure.Identity labels Jan 25, 2021
@chlowell chlowell requested a review from schaabs January 25, 2021 19:04
@chlowell chlowell marked this pull request as ready for review March 2, 2021 21:00
@chlowell chlowell requested a review from mccoyp as a code owner March 2, 2021 21:00
# this eliminates the need for your application to prompt for authentication every time it runs.
# An authentication record stored by your application enables other credentials to access data from
# past authentications. If the cache contains sufficient data, this eliminates the need for your
# application to prompt for authentication every time it runs.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say that maybe we should mention that allowing other credentials to access this data is optional, except that's probably outside the scope of a short sample. Also, that information is covered in the code snippet for TokenCachePersistenceOptions, so I think that should be sufficient

@chlowell chlowell enabled auto-merge (squash) March 6, 2021 00:56
@chlowell chlowell merged commit c12f30e into Azure:master Mar 6, 2021
iscai-msft added a commit that referenced this pull request Mar 8, 2021
…into update_ta_tests

* 'master' of https://github.com/Azure/azure-sdk-for-python:
  Update get_package_properties.py logic for python 2.7 (#17144)
  update changelog (#17150)
  [ServiceBus] 7.1.0 Release update changelog (#17135)
  [ServiceBus] Object mapping support (#17080)
  move SetTestPipeline into its own template (#17141)
  Revise token cache configuration API (#16326)
  Fix dup cloud error (#17097)
  Perf tests for monitor exporter (#17067)
  [Communication] - Phone Number - Redesigned API (#16671)
  disable retry (#17078)
  [Key Vault] Add perf tests for certificates, keys, and secrets (#17073)
  [text analytics] Analyze updates for v5.1.0b6 (#17003)
  Add any additional claims to AuthenticationRequiredError (#17136)
  Fix logic in SetTestPipelineVersionInEngCommon (#17138)
  [Key Vault] Make test resource cleanup script asynchronous (#17032)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Identity Client This issue points to a problem in the data-plane of the library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants