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

reset provider creds on every invocation #401

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ public AbstractWrapper(final CredentialsProvider providerCredentialsProvider,
// sync.
// Both are required parameters when LoggingConfig (optional) is provided when
// 'RegisterType'.
// reset provider credentials back to null to avoid reusing stale credentials
this.providerCredentialsProvider.resetCredentials();
this.providerMetricsPublisher = null;
this.providerEventsLogger = null;
this.cloudWatchLogHelper = null;

if (providerCredentials != null) {
if (this.providerCredentialsProvider != null) {
this.providerCredentialsProvider.setCredentials(providerCredentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void handleRequest(final InputStream inputStream, final OutputStream outp
TerminalException {
if (platformLogPublisher == null) {
platformLogPublisher = new LambdaLogPublisher(context.getLogger());
this.platformLoggerProxy.addLogPublisher(platformLogPublisher);
}
this.platformLoggerProxy.addLogPublisher(platformLogPublisher);
ammokhov marked this conversation as resolved.
Show resolved Hide resolved
processRequest(inputStream, outputStream);
outputStream.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ public interface CredentialsProvider {
* @param credentials, incoming credentials for the call that is being made
*/
void setCredentials(Credentials credentials);

/**
* set credentials back to null to avoid reusing stale creds
*/
void resetCredentials();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ public void setCredentials(final Credentials credentials) {
this.awsSessionCredentials = AwsSessionCredentials.create(credentials.getAccessKeyId(), credentials.getSecretAccessKey(),
credentials.getSessionToken());
}

@Override
public void resetCredentials() {
this.awsSessionCredentials = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ public AwsSessionCredentials get() {
public void setCredentials(Credentials credentials) {

}

@Override
public void resetCredentials() {

}
};
}

Expand Down