(self, credential_type, old_entry, new_key_value_pairs=None)
| 456 | self.modify(self.CredentialType.APP_METADATA, app_metadata, app_metadata) |
| 457 | |
| 458 | def modify(self, credential_type, old_entry, new_key_value_pairs=None): |
| 459 | # Modify the specified old_entry with new_key_value_pairs, |
| 460 | # or remove the old_entry if the new_key_value_pairs is None. |
| 461 | |
| 462 | # This helper exists to consolidate all token add/modify/remove behaviors, |
| 463 | # so that the sub-classes will have only one method to work on, |
| 464 | # instead of patching a pair of update_xx() and remove_xx() per type. |
| 465 | # You can monkeypatch self.key_makers to support more types on-the-fly. |
| 466 | key = self.key_makers[credential_type](**old_entry) |
| 467 | with self._lock: |
| 468 | if new_key_value_pairs: # Update with them |
| 469 | entries = self._cache.setdefault(credential_type, {}) |
| 470 | entries[key] = dict( |
| 471 | old_entry, # Do not use entries[key] b/c it might not exist |
| 472 | **new_key_value_pairs) |
| 473 | else: # Remove old_entry |
| 474 | self._cache.setdefault(credential_type, {}).pop(key, None) |
| 475 | |
| 476 | def remove_rt(self, rt_item): |
| 477 | assert rt_item.get("credential_type") == self.CredentialType.REFRESH_TOKEN |
no outgoing calls