Skip to content

Conversation

JuanLeee
Copy link
Contributor

Description

The auth plugins should only retry connection attempts with a new token if the initial attempt failed due to expired token from the cache.

Need to port over this fix from JDBC: aws/aws-advanced-jdbc-wrapper#1430

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

token_info = FederatedAuthPlugin._token_cache.get(cache_key)

if token_info is not None and not token_info.is_expired():
is_cached_token = token_info is not None and not token_info.is_expired()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar logic to JDBC wrapper

assert WrapperProperties.PASSWORD.get(test_props) == _TEST_TOKEN

@patch("aws_advanced_python_wrapper.federated_plugin.FederatedAuthPlugin._token_cache", _token_cache)
def test_no_cached_token_raises_exception(mocker, mock_plugin_service, mock_session, mock_func, mock_client, mock_dialect,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't see any unit tests associated with the JDBC wrapper so not sure if this is appropriate.

@JuanLeee JuanLeee force-pushed the auth/checkToken branch 3 times, most recently from 250f93f to 61b4d00 Compare June 17, 2025 09:59
@karenc-bq karenc-bq merged commit 91d90b9 into aws:main Jun 23, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants