|
@@ -52,10 +52,12 @@ import java.io.IOException;
|
|
import java.net.URI;
|
|
import java.net.URI;
|
|
import java.security.PrivilegedExceptionAction;
|
|
import java.security.PrivilegedExceptionAction;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.EnumSet;
|
|
import java.util.LinkedList;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import static org.apache.hadoop.crypto.key.kms.server.KMSACLs.INVALIDATE_CACHE_TYPES;
|
|
import static org.apache.hadoop.util.KMSUtil.checkNotEmpty;
|
|
import static org.apache.hadoop.util.KMSUtil.checkNotEmpty;
|
|
import static org.apache.hadoop.util.KMSUtil.checkNotNull;
|
|
import static org.apache.hadoop.util.KMSUtil.checkNotNull;
|
|
|
|
|
|
@@ -95,6 +97,12 @@ public class KMS {
|
|
KMSWebApp.getACLs().assertAccess(aclType, ugi, operation, key);
|
|
KMSWebApp.getACLs().assertAccess(aclType, ugi, operation, key);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void assertAccess(EnumSet<KMSACLs.Type> aclTypes,
|
|
|
|
+ UserGroupInformation ugi, KMSOp operation, String key)
|
|
|
|
+ throws AccessControlException {
|
|
|
|
+ KMSWebApp.getACLs().assertAccess(aclTypes, ugi, operation, key);
|
|
|
|
+ }
|
|
|
|
+
|
|
private static KeyProvider.KeyVersion removeKeyMaterial(
|
|
private static KeyProvider.KeyVersion removeKeyMaterial(
|
|
KeyProvider.KeyVersion keyVersion) {
|
|
KeyProvider.KeyVersion keyVersion) {
|
|
return new KMSClientProvider.KMSKeyVersion(keyVersion.getName(),
|
|
return new KMSClientProvider.KMSKeyVersion(keyVersion.getName(),
|
|
@@ -270,7 +278,7 @@ public class KMS {
|
|
KMSWebApp.getAdminCallsMeter().mark();
|
|
KMSWebApp.getAdminCallsMeter().mark();
|
|
checkNotEmpty(name, "name");
|
|
checkNotEmpty(name, "name");
|
|
UserGroupInformation user = HttpUserGroupInformation.get();
|
|
UserGroupInformation user = HttpUserGroupInformation.get();
|
|
- assertAccess(KMSACLs.Type.ROLLOVER, user, KMSOp.INVALIDATE_CACHE, name);
|
|
|
|
|
|
+ assertAccess(INVALIDATE_CACHE_TYPES, user, KMSOp.INVALIDATE_CACHE, name);
|
|
LOG.debug("Invalidating cache with key name {}.", name);
|
|
LOG.debug("Invalidating cache with key name {}.", name);
|
|
|
|
|
|
user.doAs(new PrivilegedExceptionAction<Void>() {
|
|
user.doAs(new PrivilegedExceptionAction<Void>() {
|