aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-03-05 10:36:20 +0100
committerJon Marius Venstad <venstad@gmail.com>2020-03-05 10:36:20 +0100
commita71918045f8f6b58e701deee1d870f7e303a64e1 (patch)
tree6478c663ae7ca0b6faaab3bae5145a5292e4f527
parent3c66bd5825848e3f95452776f274631b2db5f076 (diff)
Define equality for composite cache keys in AthenzFacade
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java
index 4a874c670ec..f9aec1a39af 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/athenz/impl/AthenzFacade.java
@@ -35,6 +35,7 @@ import com.yahoo.vespa.hosted.controller.tenant.Tenant;
import javax.ws.rs.ForbiddenException;
import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -296,15 +297,34 @@ public class AthenzFacade implements AccessControl {
_modify_
}
+
private static class AccessTuple {
+
private final String resource;
private final String action;
private final AthenzIdentity identity;
+
private AccessTuple(String resource, String action, AthenzIdentity identity) {
this.resource = resource;
this.action = action;
this.identity = identity;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ AccessTuple that = (AccessTuple) o;
+ return resource.equals(that.resource) &&
+ action.equals(that.action) &&
+ identity.equals(that.identity);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(resource, action, identity);
+ }
+
}
}