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

Adding support for BasicSessionCredentials #74

Open
xbranko opened this issue Jan 14, 2014 · 0 comments
Open

Adding support for BasicSessionCredentials #74

xbranko opened this issue Jan 14, 2014 · 0 comments

Comments

@xbranko
Copy link

xbranko commented Jan 14, 2014

Would it be possible to add support for BasicSessionCredentials too? In my company we use BasicSessionCredentials and not BasicAWSCredentials.

Looking at the code, it seems that this would require a minimal and rather local change to the constructor for the AmazonAwsSQSConnector, to allow it to get the sessionToken in addition to the current parameters:

 public AmazonAwsSQSConnector(String awsAccessKey, String awsSecretKey, String awsSessionToken, boolean isSecure, long receiveCheckIntervalMs) {
    this(awsAccessKey, awsSecretKey, awsSessionToken, isSecure, receiveCheckIntervalMs, false);
}

 public AmazonAwsSQSConnector(String awsAccessKey, String awsSecretKey, String awsSessionToken, boolean isSecure, long receiveCheckIntervalMs, boolean isAsync) {
    super(receiveCheckIntervalMs, isAsync);
    AWSCredentials awsCredentials = (awsSessionToken == null)? new BasicAWSCredentials(awsAccessKey, awsSecretKey) : new BasicSessionCredentials(awsAccessKey, awsSecretKey, awsSessionToken); 
// ... everything else stays the same

Other required change is in the AmazonAwsSQSConnectorFactory where the AmazonAwsSQSConnector is used:

 public AmazonAwsSQSConnector getInstance(String awsAccessKey, String awsSecretKey, String awsSessionToken, String awsSQSEndpoint, String awsSNSEndpoint) {
    AmazonAwsSQSConnector amazonAwsSQSConnector = new AmazonAwsSQSConnector(awsAccessKey, awsSecretKey, awsSessionToken, _isSecure,
            _receiveCheckIntervalMs, _useAsyncSend); 
// ... everything else stays the same

This way people who use BasicAWSCredentials will still be able to with minimal effort.

Many thanks in advance!

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

1 participant