AuthorizationService

excludes guest
This commit is contained in:
Alfredo Oliviero 2024-02-23 17:05:11 +01:00
parent 12d5b2a1ad
commit bacba3984c
5 changed files with 11 additions and 5 deletions

View File

@ -20,6 +20,9 @@ start the docker container
test urls (replace {{TOKEN}} with your token): test urls (replace {{TOKEN}} with your token):
http://localhost:8080/helloworld/guest
http://localhost:8080/helloworld/details?gcube-token={{TOKEN}} http://localhost:8080/helloworld/details?gcube-token={{TOKEN}}
http://localhost:8080/helloworld/hello/details?gcube-token={{TOKEN}} http://localhost:8080/helloworld/hello/details?gcube-token={{TOKEN}}

View File

@ -4,4 +4,5 @@ version: 1.0.0
description: HelloWorld Service description: HelloWorld Service
excludes: excludes:
- path: /excluded - path: /excluded
- path: /guest
- path: /api-docs/* - path: /api-docs/*

View File

@ -9,6 +9,7 @@ import javax.ws.rs.core.Application;
import org.gcube.service.helloworld.services.AuthorizedMethods; import org.gcube.service.helloworld.services.AuthorizedMethods;
import org.gcube.service.helloworld.services.ExcludeAuthorization; import org.gcube.service.helloworld.services.ExcludeAuthorization;
import org.gcube.service.helloworld.services.HelloService; import org.gcube.service.helloworld.services.HelloService;
import org.gcube.service.helloworld.services.TestAuthorizationService;
@ApplicationPath("") @ApplicationPath("")
@ -18,8 +19,9 @@ public class HelloWorld extends Application {
final Set<Class<?>> classes = new HashSet<Class<?>>(); final Set<Class<?>> classes = new HashSet<Class<?>>();
// register resources classes implementing Servlets // register resources classes implementing Servlets
classes.add(HelloService.class); classes.add(HelloService.class);
classes.add(AuthorizedMethods.class);
classes.add(ExcludeAuthorization.class); classes.add(ExcludeAuthorization.class);
classes.add(TestAuthorizationService.class);
return classes; return classes;
} }
} }

View File

@ -11,7 +11,7 @@ import org.gcube.common.security.secrets.Secret;
import org.gcube.smartgears.utils.InnerMethodName; import org.gcube.smartgears.utils.InnerMethodName;
@Path("auth") @Path("auth")
public class AuthorizedMethods { public class TestAuthorizationService {
private static final String ALLOWED_ROLE = "myRole"; private static final String ALLOWED_ROLE = "myRole";
private static final String ALLOWED_ROLE_ORG = "OrganizationMember"; private static final String ALLOWED_ROLE_ORG = "OrganizationMember";

View File

@ -6,10 +6,10 @@ import javax.ws.rs.Path;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@Path("excluded") @Path("guest")
public class ExcludeAuthorization { public class ExcludeAuthorizationService {
private final Logger logger = LoggerFactory.getLogger(ExcludeAuthorization.class); private final Logger logger = LoggerFactory.getLogger(ExcludeAuthorizationService.class);
/** /**