Added an example of ecluded method
This commit is contained in:
parent
6ce907d32d
commit
7e53d716fc
|
@ -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/
|
||||
|
|
|
@ -3,4 +3,5 @@ group: org.gcube.service
|
|||
version: 1.0.0
|
||||
description: HelloWorld Service
|
||||
excludes:
|
||||
- path: /excluded
|
||||
- path: /api-docs/*
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue