While trying to get Amazon S3 authentication working for my RESTful web service, my testing flushed out a possible bug in the Verifier for S3 auth. If you specify an access key that does not exist in the server secrets, the AwsVerifier throws a NullPointerException which results in an HTTP 500 Internal Server Error. The problem begins on line 233 of AwsVerifier.java:
char[] userSecret = getLocalSecret(userId);
If the userId does not exist in the local secrets (i.e an access key that does not exist in the server secrets map) then there is no associated secret, so userSecret becomes null. When AwsVerifier calls getS3Signature() on line 235:
String sigToCompare = AwsUtils.getS3Signature(request, userSecret);
you get the NullPointerException. This seems like a bug to me...anyone agree/disagree?