diff options
Diffstat (limited to 'jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/athenz/RequestResourceMapper.java')
-rw-r--r-- | jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/athenz/RequestResourceMapper.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/athenz/RequestResourceMapper.java b/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/athenz/RequestResourceMapper.java new file mode 100644 index 00000000000..00c3c27d57b --- /dev/null +++ b/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/athenz/RequestResourceMapper.java @@ -0,0 +1,37 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.http.filter.security.athenz; + +import com.yahoo.vespa.athenz.api.AthenzResourceName; + +import java.util.Optional; + +/** + * Maps a request to an {@link AthenzResourceName} and an action. + * + * @author bjorncs + */ +public interface RequestResourceMapper { + + /** + * @return A resource name + action to use for access control, empty if no access control should be performed. + */ + Optional<ResourceNameAndAction> getResourceNameAndMapping(String method, String uriPath, String uriQuery); + + class ResourceNameAndAction { + private final AthenzResourceName resourceName; + private final String action; + + public ResourceNameAndAction(AthenzResourceName resourceName, String action) { + this.resourceName = resourceName; + this.action = action; + } + + public AthenzResourceName resourceName() { + return resourceName; + } + + public String action() { + return action; + } + } +} |