diff --git a/Dockerfile b/Dockerfile index a2b7de3..99c0481 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM smartgears-distribution:4.0.0-SNAPSHOT-java11-tomcat9 +FROM d4science/smartgears-distribution:4.0.0-SNAPSHOT-java11-tomcat9 COPY ./docker/logback.xml /etc/ COPY ./docker/container.ini /etc/ diff --git a/gcube/extra-resources/WEB-INF/application.yaml b/gcube/extra-resources/WEB-INF/application.yaml index 3ebdecb..0c8814e 100644 --- a/gcube/extra-resources/WEB-INF/application.yaml +++ b/gcube/extra-resources/WEB-INF/application.yaml @@ -3,4 +3,5 @@ group: org.gcube.service version: 1.0.0 description: HelloWorld Service excludes: + - path: /excluded - path: /api-docs/* \ No newline at end of file diff --git a/src/main/java/org/gcube/service/helloworld/HelloWorld.java b/src/main/java/org/gcube/service/helloworld/HelloWorld.java index e463df0..d3be3ab 100644 --- a/src/main/java/org/gcube/service/helloworld/HelloWorld.java +++ b/src/main/java/org/gcube/service/helloworld/HelloWorld.java @@ -7,6 +7,7 @@ import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.gcube.service.helloworld.services.AuthorizedMethods; +import org.gcube.service.helloworld.services.ExcludeAuthorization; import org.gcube.service.helloworld.services.HelloService; @@ -18,6 +19,7 @@ public class HelloWorld extends Application { // register resources classes implementing Servlets classes.add(HelloService.class); classes.add(AuthorizedMethods.class); + classes.add(ExcludeAuthorization.class); return classes; } } diff --git a/src/main/java/org/gcube/service/helloworld/services/ExcludeAuthorization.java b/src/main/java/org/gcube/service/helloworld/services/ExcludeAuthorization.java new file mode 100644 index 0000000..f65d3cf --- /dev/null +++ b/src/main/java/org/gcube/service/helloworld/services/ExcludeAuthorization.java @@ -0,0 +1,31 @@ +package org.gcube.service.helloworld.services; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Path("excluded") +public class ExcludeAuthorization { + + private final Logger logger = LoggerFactory.getLogger(ExcludeAuthorization.class); + + + /** + * this method doesn't need authorization and the SecretManagerProvider is null + * see to implement this behavior add to excludes section in your application.yaml + * + * - path: /{path-to-your-method-path} + * + * example for this method + * + * - path: /excluded + * + */ + @GET + public String exludedMethod() { + logger.info("executed whithout any authorization"); + return "executed whithout any authorization"; + } +}