All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bazaarvoice.emodb.blob.client.BlobStoreAuthenticator Maven / Gradle / Ivy

package com.bazaarvoice.emodb.blob.client;

import com.bazaarvoice.emodb.auth.InvalidCredentialException;
import com.bazaarvoice.emodb.auth.proxy.CachingAuthenticatingProxy;
import com.bazaarvoice.emodb.blob.api.AuthBlobStore;
import com.bazaarvoice.emodb.blob.api.BlobStore;

/**
 *
 */
public class BlobStoreAuthenticator extends CachingAuthenticatingProxy {

    private final AuthBlobStore _authBlobStore;

    public static BlobStoreAuthenticator proxied(AuthBlobStore secureDatabus) {
        return new BlobStoreAuthenticator(secureDatabus);
    }

    private BlobStoreAuthenticator(AuthBlobStore authBlobStore) {
        _authBlobStore = authBlobStore;
    }

    @Override
    protected String validateCredentials(String apiKey) throws InvalidCredentialException {
        if (apiKey.isEmpty()) {
            throw new InvalidCredentialException("API key cannot be empty");
        }
        return apiKey;
    }

    @Override
    protected BlobStore createInstanceWithCredentials(String apiKey) {
        return new BlobStoreAuthenticatorProxy(_authBlobStore, apiKey);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy