Search in sources :

Example 1 with AccessKeyStorage

use of org.apache.dubbo.auth.spi.AccessKeyStorage in project dubbo by alibaba.

the class AccessKeyAuthenticator method getAccessKeyPair.

AccessKeyPair getAccessKeyPair(Invocation invocation, URL url) {
    AccessKeyStorage accessKeyStorage = ExtensionLoader.getExtensionLoader(AccessKeyStorage.class).getExtension(url.getParameter(Constants.ACCESS_KEY_STORAGE_KEY, Constants.DEFAULT_ACCESS_KEY_STORAGE));
    AccessKeyPair accessKeyPair = null;
    try {
        accessKeyPair = accessKeyStorage.getAccessKey(url, invocation);
        if (accessKeyPair == null || StringUtils.isEmpty(accessKeyPair.getAccessKey()) || StringUtils.isEmpty(accessKeyPair.getSecretKey())) {
            throw new AccessKeyNotFoundException("AccessKeyId or secretAccessKey not found");
        }
    } catch (Exception e) {
        throw new RuntimeException("Can't load the AccessKeyPair from accessKeyStorage", e);
    }
    return accessKeyPair;
}
Also used : AccessKeyNotFoundException(org.apache.dubbo.auth.exception.AccessKeyNotFoundException) AccessKeyPair(org.apache.dubbo.auth.model.AccessKeyPair) AccessKeyStorage(org.apache.dubbo.auth.spi.AccessKeyStorage) RpcAuthenticationException(org.apache.dubbo.auth.exception.RpcAuthenticationException) AccessKeyNotFoundException(org.apache.dubbo.auth.exception.AccessKeyNotFoundException)

Aggregations

AccessKeyNotFoundException (org.apache.dubbo.auth.exception.AccessKeyNotFoundException)1 RpcAuthenticationException (org.apache.dubbo.auth.exception.RpcAuthenticationException)1 AccessKeyPair (org.apache.dubbo.auth.model.AccessKeyPair)1 AccessKeyStorage (org.apache.dubbo.auth.spi.AccessKeyStorage)1