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

Caching access token #2

Open
stevemit opened this issue Oct 6, 2022 · 4 comments
Open

Caching access token #2

stevemit opened this issue Oct 6, 2022 · 4 comments

Comments

@stevemit
Copy link

stevemit commented Oct 6, 2022

This is a great little piece of code, but it connects to AWS twice for each Maven request, including metadata requests. Have you considered caching the access token and an expiration timestamp, say in a system property (one access per 'mvn' process)?

@OneGeek
Copy link
Owner

OneGeek commented Oct 7, 2022

I did try to use the "singleton" lifecycle for the wagon to at least reuse the client instance, but ran into issues. A cache is doable, but I think I would need to a cache that maps the repo "url" to the token for it.

@stevemit
Copy link
Author

stevemit commented Oct 7, 2022

Maybe cache the token and its timestamp in system properties named "aws-code-wgn-XXXXXX-token" and "aws-code-wgn-XXXXXX-timestamp" where XXXXXX is the repo id or a hash of the URL. Consider using the actual http URL configured in settings.xml -- it needn't be dynamic.

@OneGeek
Copy link
Owner

OneGeek commented Oct 10, 2022

What do you mean the actual http URL configured in settings.xml? The http url is determined dynamically using the AWS SDK.

@stevemit
Copy link
Author

The URL is available from the AWS SDK and the web console, but it is static and follows a fixed pattern -- something like
https://domain-account.d.codeartifact.region.amazonaws.com/maven/repository/

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

No branches or pull requests

2 participants