-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Labels
Description
Hi there,
It would be great to see an example implementation of how to modify the tokenCache to store in a simple DB/Cache system such as Redis.
microsoft-authentication-library-for-python/msal/token_cache.py
Lines 283 to 304 in e4510a3
| def add(self, event, **kwargs): | |
| super(SerializableTokenCache, self).add(event, **kwargs) | |
| self.has_state_changed = True | |
| def modify(self, credential_type, old_entry, new_key_value_pairs=None): | |
| super(SerializableTokenCache, self).modify( | |
| credential_type, old_entry, new_key_value_pairs) | |
| self.has_state_changed = True | |
| def deserialize(self, state): | |
| # type: (Optional[str]) -> None | |
| """Deserialize the cache from a state previously obtained by serialize()""" | |
| with self._lock: | |
| self._cache = json.loads(state) if state else {} | |
| self.has_state_changed = False # reset | |
| def serialize(self): | |
| # type: () -> str | |
| """Serialize the current cache state into a string.""" | |
| with self._lock: | |
| self.has_state_changed = False | |
| return json.dumps(self._cache, indent=4) |
For a DB such as Redis:
- What methods are most important to modify?
- What is the structure of the cache? What is the key/value to store?
I also have a couple of other high-level questions:
- Is there a cache value for each account? Does it make sense to store it in a place related to that user?
- Is the cache value one big encrypted string that needs to be stored a cache system such as Redis and has no direct relation to an account?
Thanks
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Commited