Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Change getCacheKey implementation for more unique keys #560

Merged
merged 17 commits into from
Jul 10, 2024

Conversation

Hectorhammett
Copy link
Contributor

We made changes to how we calculate the cacheKeys in order to avoid collision for the oncoming support for the Caching update.

closes: #559

@Hectorhammett Hectorhammett force-pushed the remove-oauth-dependency branch 3 times, most recently from 6ccea31 to 126d7ec Compare June 6, 2024 18:33
@Hectorhammett Hectorhammett force-pushed the remove-oauth-dependency branch from 126d7ec to 4317d4f Compare June 6, 2024 18:38
@Hectorhammett Hectorhammett requested a review from bshaffer June 6, 2024 18:40
@Hectorhammett Hectorhammett marked this pull request as ready for review June 6, 2024 18:40
@Hectorhammett Hectorhammett requested a review from a team as a code owner June 6, 2024 18:40
Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

Good job! I think we can improve a few things. Additionally, I'd like to see PHPDoc comments for the getCacheKey method which explains which fields are included in the cache key.

src/Credentials/ExternalAccountCredentials.php Outdated Show resolved Hide resolved
src/Credentials/GCECredentials.php Show resolved Hide resolved
src/OAuth2.php Outdated Show resolved Hide resolved
@Hectorhammett Hectorhammett force-pushed the remove-oauth-dependency branch from a0dc04d to 8415d95 Compare June 7, 2024 20:25
@Hectorhammett Hectorhammett requested a review from bshaffer June 7, 2024 20:27
src/CredentialSource/AwsNativeSource.php Show resolved Hide resolved
src/CredentialSource/AwsNativeSource.php Outdated Show resolved Hide resolved
src/CredentialSource/ExecutableSource.php Outdated Show resolved Hide resolved
src/CredentialSource/UrlSource.php Outdated Show resolved Hide resolved
src/Credentials/ExternalAccountCredentials.php Outdated Show resolved Hide resolved
@Hectorhammett Hectorhammett requested a review from bshaffer June 13, 2024 20:41
@bshaffer bshaffer requested a review from westarle June 19, 2024 18:56
@bshaffer
Copy link
Contributor

@westarle We are looking to merge this soon, and would love you to take a look!

Copy link
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

nits and minor suggestions only!

src/CredentialSource/AwsNativeSource.php Show resolved Hide resolved
src/CredentialSource/ExecutableSource.php Outdated Show resolved Hide resolved
src/Credentials/ServiceAccountCredentials.php Outdated Show resolved Hide resolved
src/Credentials/ServiceAccountCredentials.php Outdated Show resolved Hide resolved
src/Credentials/ServiceAccountJwtAccessCredentials.php Outdated Show resolved Hide resolved
src/Credentials/ServiceAccountJwtAccessCredentials.php Outdated Show resolved Hide resolved
src/Credentials/UserRefreshCredentials.php Outdated Show resolved Hide resolved
src/Credentials/UserRefreshCredentials.php Outdated Show resolved Hide resolved
src/CredentialSource/AwsNativeSource.php Outdated Show resolved Hide resolved
src/Credentials/ExternalAccountCredentials.php Outdated Show resolved Hide resolved
@Hectorhammett Hectorhammett requested a review from bshaffer July 3, 2024 15:10
@Hectorhammett Hectorhammett requested a review from bshaffer July 9, 2024 18:31
src/CredentialSource/AwsNativeSource.php Outdated Show resolved Hide resolved
src/Credentials/ExternalAccountCredentials.php Outdated Show resolved Hide resolved
src/OAuth2.php Outdated Show resolved Hide resolved
src/Credentials/ExternalAccountCredentials.php Outdated Show resolved Hide resolved
@Hectorhammett Hectorhammett requested a review from bshaffer July 10, 2024 14:31
return ($this->imdsv2SessionTokenUrl ?? '') .
'.' . ($this->securityCredentialsUrl ?? '') .
'.' . $this->regionUrl .
'.' . $this->regionalCredVerificationUrl;
Copy link
Contributor

@bshaffer bshaffer Jul 10, 2024

Choose a reason for hiding this comment

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

I just had a thought... one way you could get rid of the . without having a separate function is to do something like this:

return implode('.', array_filter([
    $this->imdsv2SessionTokenUrl,
    $this->securityCredentialsUrl,
    $this->regionUrl,
    $this->regionalCredVerificationUrl
]));

But I don't think that's necessary... what we have here looks LGTM to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Brent, you a genius, I do like that better haha.

@bshaffer bshaffer merged commit a35c4db into main Jul 10, 2024
12 checks passed
@bshaffer bshaffer deleted the remove-oauth-dependency branch July 10, 2024 14:49
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.

Audit Cache Keys to determine if they are unique enough while caching auth tokens
2 participants