Skip to content

Commit

Permalink
Compare identity in blobstore locator
Browse files Browse the repository at this point in the history
This allows S3Proxy to return the more specific InvalidAccessKeyId
instead of SignatureDoesNotMatch.  Addresses a s3-tests regression in
s3tests.functional.test_s3:test_list_buckets_invalid_auth.
  • Loading branch information
gaul committed Apr 4, 2015
1 parent 1981730 commit 7271a5a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,16 @@ final class S3ProxyHandler extends AbstractHandler {
XMLOutputFactory.newInstance();
private BlobStoreLocator blobStoreLocator;

S3ProxyHandler(final BlobStore blobStore, String identity,
S3ProxyHandler(final BlobStore blobStore, final String identity,
final String credential, Optional<String> virtualHost) {
if (identity != null) {
blobStoreLocator = new BlobStoreLocator() {
@Override
public Map.Entry<String, BlobStore> locateBlobStore(
String identity, String container, String blob) {
String identityArg, String container, String blob) {
if (!identity.equals(identityArg)) {
return null;
}
return Maps.immutableEntry(credential, blobStore);
}
};
Expand All @@ -174,7 +177,7 @@ public Map.Entry<String, BlobStore> locateBlobStore(
blobStoreLocator = new BlobStoreLocator() {
@Override
public Map.Entry<String, BlobStore> locateBlobStore(
String identity, String container, String blob) {
String identityArg, String container, String blob) {
return null;
}
};
Expand Down

0 comments on commit 7271a5a

Please sign in to comment.