From 30885e03613f8a2794f9d7c7e2fad419602677d1 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Wed, 26 Oct 2016 08:12:47 +0000 Subject: [PATCH] minor fixes git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@133557 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/org.eclipse.wst.common.component | 3 --- .../grsf_publish_ws/ex/ApplicationException.java | 2 +- .../filters/RequestsAuthAccountingFilter.java | 8 ++++++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index d3d2b68..6caf699 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -3,9 +3,6 @@ - - uses - diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/ex/ApplicationException.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/ex/ApplicationException.java index 0f9050d..a1cd9f9 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/ex/ApplicationException.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/ex/ApplicationException.java @@ -18,7 +18,7 @@ public class ApplicationException implements ExceptionMapper { private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ApplicationException.class); public Response toResponse(Exception e) { - logger.warn("ApplicationException invoked"); + logger.warn("ApplicationException invoked for error " + e); return Response .status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) .type(MediaType.APPLICATION_JSON) diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/filters/RequestsAuthAccountingFilter.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/filters/RequestsAuthAccountingFilter.java index 9254941..9c60139 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/filters/RequestsAuthAccountingFilter.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/filters/RequestsAuthAccountingFilter.java @@ -6,9 +6,11 @@ import java.io.IOException; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; +import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; import javax.ws.rs.ext.Provider; import org.gcube.common.authorization.library.AuthorizationEntry; @@ -29,12 +31,18 @@ public class RequestsAuthAccountingFilter implements ContainerRequestFilter{ private static final org.slf4j.Logger logger = LoggerFactory.getLogger(RequestsAuthAccountingFilter.class); private static final String AUTH_TOKEN = "gcube-token"; + + @Context UriInfo info; @Override public void filter(ContainerRequestContext requestContext) throws IOException { logger.info("Intercepted request, checking if it contains authorization token"); + String pathRequest = info.getAbsolutePath().toString(); + + if(pathRequest.contains("hello") || pathRequest.endsWith("rest/")) + return; // check if the request contains gcube-token String tokenInHeader = null, tokenAsQueryParameter = null;