Return immutable credentials. The ``access_key``, ``secret_key``, and ``token`` properties on this class will always check and refresh credentials if needed before returning the particular credentials. This has an edge case where you can get inconsistent cre
(self)
| 655 | self._normalize() |
| 656 | |
| 657 | def get_frozen_credentials(self): |
| 658 | """Return immutable credentials. |
| 659 | |
| 660 | The ``access_key``, ``secret_key``, and ``token`` properties |
| 661 | on this class will always check and refresh credentials if |
| 662 | needed before returning the particular credentials. |
| 663 | |
| 664 | This has an edge case where you can get inconsistent |
| 665 | credentials. Imagine this: |
| 666 | |
| 667 | # Current creds are "t1" |
| 668 | tmp.access_key ---> expired? no, so return t1.access_key |
| 669 | # ---- time is now expired, creds need refreshing to "t2" ---- |
| 670 | tmp.secret_key ---> expired? yes, refresh and return t2.secret_key |
| 671 | |
| 672 | This means we're using the access key from t1 with the secret key |
| 673 | from t2. To fix this issue, you can request a frozen credential object |
| 674 | which is guaranteed not to change. |
| 675 | |
| 676 | The frozen credentials returned from this method should be used |
| 677 | immediately and then discarded. The typical usage pattern would |
| 678 | be:: |
| 679 | |
| 680 | creds = RefreshableCredentials(...) |
| 681 | some_code = SomeSignerObject() |
| 682 | # I'm about to sign the request. |
| 683 | # The frozen credentials are only used for the |
| 684 | # duration of generate_presigned_url and will be |
| 685 | # immediately thrown away. |
| 686 | request = some_code.sign_some_request( |
| 687 | with_credentials=creds.get_frozen_credentials()) |
| 688 | print("Signed request:", request) |
| 689 | |
| 690 | """ |
| 691 | self._refresh() |
| 692 | return self._frozen_credentials |
| 693 | |
| 694 | |
| 695 | class DeferredRefreshableCredentials(RefreshableCredentials): |