From 1fa5705e1ed8a3b2f3474be78ce8eec40dd9abcf Mon Sep 17 00:00:00 2001 From: kennethmhc Date: Sun, 7 Apr 2024 23:54:50 +0200 Subject: [PATCH] [FSTORE-1299] Add feature store scope to elastic jwt endpoint (3.7) (#1507) --- .../hopsworks/api/opensearch/OpenSearchService.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/opensearch/OpenSearchService.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/opensearch/OpenSearchService.java index c2b8b85a15..254242c48d 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/opensearch/OpenSearchService.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/opensearch/OpenSearchService.java @@ -41,16 +41,16 @@ import com.google.common.base.Strings; import io.hops.hopsworks.api.auth.key.ApiKeyRequired; -import io.hops.hopsworks.api.opensearch.featurestore.OpenSearchFeaturestoreBuilder; -import io.hops.hopsworks.api.opensearch.featurestore.OpenSearchFeaturestoreDTO; -import io.hops.hopsworks.api.opensearch.featurestore.OpenSearchFeaturestoreRequest; import io.hops.hopsworks.api.filter.AllowedProjectRoles; import io.hops.hopsworks.api.filter.Audience; -import io.hops.hopsworks.api.jwt.OpenSearchJWTResponseDTO; import io.hops.hopsworks.api.jwt.JWTHelper; +import io.hops.hopsworks.api.jwt.OpenSearchJWTResponseDTO; +import io.hops.hopsworks.api.opensearch.featurestore.OpenSearchFeaturestoreBuilder; +import io.hops.hopsworks.api.opensearch.featurestore.OpenSearchFeaturestoreDTO; +import io.hops.hopsworks.api.opensearch.featurestore.OpenSearchFeaturestoreRequest; import io.hops.hopsworks.common.opensearch.FeaturestoreDocType; -import io.hops.hopsworks.exceptions.OpenSearchException; import io.hops.hopsworks.exceptions.GenericException; +import io.hops.hopsworks.exceptions.OpenSearchException; import io.hops.hopsworks.exceptions.ServiceException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.user.Users; @@ -216,7 +216,8 @@ public Response featurestoreSearch( @AllowedProjectRoles({AllowedProjectRoles.DATA_SCIENTIST, AllowedProjectRoles.DATA_OWNER}) @JWTRequired(acceptedTokens = {Audience.API, Audience.JOB}, allowedUserRoles = {"HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER"}) - @ApiKeyRequired(acceptedScopes = {ApiScope.PYTHON_LIBRARIES}, allowedUserRoles = {"HOPS_ADMIN", "HOPS_USER", + @ApiKeyRequired(acceptedScopes = {ApiScope.PYTHON_LIBRARIES, ApiScope.FEATURESTORE}, + allowedUserRoles = {"HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER"}) public Response createJwtToken(@Context SecurityContext sc, @PathParam("projectId") Integer projectId) throws OpenSearchException {