Refactoring auth to be contained in BucketSettings

Also wrote some tests.