diff --git a/pom.xml b/pom.xml index cc23fd0..98d5e18 100644 --- a/pom.xml +++ b/pom.xml @@ -8,9 +8,9 @@ 3.1.3 - no.uio.ifi + no.elixir.fega localega-tsd-proxy - 1.1.7 + 2.0.0 localega-tsd-proxy LocalEGA TSD Proxy diff --git a/src/main/java/no/uio/ifi/ltp/LocalEGATSDProxyApplication.java b/src/main/java/no/elixir/fega/ltp/LocalEGATSDProxyApplication.java similarity index 99% rename from src/main/java/no/uio/ifi/ltp/LocalEGATSDProxyApplication.java rename to src/main/java/no/elixir/fega/ltp/LocalEGATSDProxyApplication.java index c9d39ad..c329162 100644 --- a/src/main/java/no/uio/ifi/ltp/LocalEGATSDProxyApplication.java +++ b/src/main/java/no/elixir/fega/ltp/LocalEGATSDProxyApplication.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp; +package no.elixir.fega.ltp; import lombok.extern.slf4j.Slf4j; import no.uio.ifi.tc.TSDFileAPIClient; diff --git a/src/main/java/no/uio/ifi/ltp/aspects/AAIAspect.java b/src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java similarity index 89% rename from src/main/java/no/uio/ifi/ltp/aspects/AAIAspect.java rename to src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java index f0ddb57..62bdaa0 100644 --- a/src/main/java/no/uio/ifi/ltp/aspects/AAIAspect.java +++ b/src/main/java/no/elixir/fega/ltp/aspects/AAIAspect.java @@ -1,13 +1,13 @@ -package no.uio.ifi.ltp.aspects; +package no.elixir.fega.ltp.aspects; import com.auth0.jwt.JWT; import com.auth0.jwt.interfaces.DecodedJWT; import lombok.extern.slf4j.Slf4j; +import no.elixir.fega.ltp.authentication.CEGACredentialsProvider; import no.uio.ifi.clearinghouse.Clearinghouse; import no.uio.ifi.clearinghouse.model.Visa; import no.uio.ifi.clearinghouse.model.VisaType; -import no.uio.ifi.ltp.authentication.CEGACredentialsProvider; -import no.uio.ifi.ltp.dto.Credentials; +import no.elixir.fega.ltp.dto.Credentials; import org.apache.commons.codec.digest.Crypt; import org.apache.commons.lang3.StringUtils; import org.apache.http.auth.AuthenticationException; @@ -34,9 +34,6 @@ import java.util.*; import java.util.stream.Collectors; -import static no.uio.ifi.ltp.aspects.ProcessArgumentsAspect.EGA_USERNAME; -import static no.uio.ifi.ltp.aspects.ProcessArgumentsAspect.ELIXIR_ID; - /** * AOP aspect that handles authentication and authorization. */ @@ -68,7 +65,7 @@ public class AAIAspect { * @return Either the object, returned by the proxied method, or HTTP error response. * @throws Throwable In case of error. */ - @Around("execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.*(..))") + @Around("execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.*(..))") public Object authenticateElixirAAI(ProceedingJoinPoint joinPoint) throws Throwable { Optional optionalBearerAuth = getBearerAuth(); if (optionalBearerAuth.isEmpty()) { @@ -80,7 +77,7 @@ public Object authenticateElixirAAI(ProceedingJoinPoint joinPoint) throws Throwa DecodedJWT decodedJWT = JWT.decode(jwtToken); List controlledAccessGrantsVisas = getVisas(jwtToken, decodedJWT); log.info("Elixir user {} authenticated and provided following valid GA4GH Visas: {}", decodedJWT.getSubject(), controlledAccessGrantsVisas); - request.setAttribute(ELIXIR_ID, decodedJWT.getSubject()); + request.setAttribute(ProcessArgumentsAspect.ELIXIR_ID, decodedJWT.getSubject()); return joinPoint.proceed(); } catch (Exception e) { log.info(e.getMessage(), e); @@ -95,8 +92,8 @@ public Object authenticateElixirAAI(ProceedingJoinPoint joinPoint) throws Throwa * @return Either the object, returned by the proxied method, or HTTP error response. * @throws Throwable In case of error. */ - @Around("execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.*(..)) && " + - "!execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.stream(jakarta.servlet.http.HttpServletResponse, String, String))") // we don't need CEGA auth for Data Out endpoints + @Around("execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.*(..)) && " + + "!execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.stream(jakarta.servlet.http.HttpServletResponse, String, String))") // we don't need CEGA auth for Data Out endpoints public Object authenticateCEGA(ProceedingJoinPoint joinPoint) throws Throwable { if (((MethodSignature) joinPoint.getSignature()).getMethod().getName().equalsIgnoreCase("getFiles")) { if (Boolean.FALSE.equals(joinPoint.getArgs()[1])) { @@ -114,7 +111,7 @@ public Object authenticateCEGA(ProceedingJoinPoint joinPoint) throws Throwable { throw new AuthenticationException("EGA authentication failed"); } log.info("EGA user {} authenticated", usernameAndPassword[0]); - request.setAttribute(EGA_USERNAME, usernameAndPassword[0]); + request.setAttribute(ProcessArgumentsAspect.EGA_USERNAME, usernameAndPassword[0]); return joinPoint.proceed(); } catch (Exception e) { log.info(e.getMessage(), e); diff --git a/src/main/java/no/uio/ifi/ltp/aspects/CredentialsMappingAspect.java b/src/main/java/no/elixir/fega/ltp/aspects/CredentialsMappingAspect.java similarity index 82% rename from src/main/java/no/uio/ifi/ltp/aspects/CredentialsMappingAspect.java rename to src/main/java/no/elixir/fega/ltp/aspects/CredentialsMappingAspect.java index 09f5c1c..8b462ee 100644 --- a/src/main/java/no/uio/ifi/ltp/aspects/CredentialsMappingAspect.java +++ b/src/main/java/no/elixir/fega/ltp/aspects/CredentialsMappingAspect.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.aspects; +package no.elixir.fega.ltp.aspects; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -12,8 +12,8 @@ import jakarta.servlet.http.HttpServletRequest; import java.util.List; -import static no.uio.ifi.ltp.aspects.ProcessArgumentsAspect.EGA_USERNAME; -import static no.uio.ifi.ltp.aspects.ProcessArgumentsAspect.ELIXIR_ID; +import static no.elixir.fega.ltp.aspects.ProcessArgumentsAspect.EGA_USERNAME; +import static no.elixir.fega.ltp.aspects.ProcessArgumentsAspect.ELIXIR_ID; /** * AOP aspect that maps EGA username with Elixir ID. @@ -35,7 +35,7 @@ public class CredentialsMappingAspect { * * @param result Object returned by the proxied method. */ - @AfterReturning(pointcut = "execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.stream(..))", returning = "result") + @AfterReturning(pointcut = "execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.stream(..))", returning = "result") public void publishMessage(Object result) { String egaUsername = request.getAttribute(EGA_USERNAME).toString(); String elixirId = request.getAttribute(ELIXIR_ID).toString(); diff --git a/src/main/java/no/uio/ifi/ltp/aspects/ProcessArgumentsAspect.java b/src/main/java/no/elixir/fega/ltp/aspects/ProcessArgumentsAspect.java similarity index 93% rename from src/main/java/no/uio/ifi/ltp/aspects/ProcessArgumentsAspect.java rename to src/main/java/no/elixir/fega/ltp/aspects/ProcessArgumentsAspect.java index 1186f8f..12b2f35 100644 --- a/src/main/java/no/uio/ifi/ltp/aspects/ProcessArgumentsAspect.java +++ b/src/main/java/no/elixir/fega/ltp/aspects/ProcessArgumentsAspect.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.aspects; +package no.elixir.fega.ltp.aspects; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; @@ -42,7 +42,7 @@ public class ProcessArgumentsAspect { * @throws Throwable In case of error. */ @SuppressWarnings("rawtypes") - @Around("execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.stream(..)) || execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.deleteFile(..))") + @Around("execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.stream(..)) || execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.deleteFile(..))") public Object processArguments(ProceedingJoinPoint joinPoint) throws Throwable { try { Object[] arguments = joinPoint.getArgs(); diff --git a/src/main/java/no/uio/ifi/ltp/aspects/PublishMQAspect.java b/src/main/java/no/elixir/fega/ltp/aspects/PublishMQAspect.java similarity index 91% rename from src/main/java/no/uio/ifi/ltp/aspects/PublishMQAspect.java rename to src/main/java/no/elixir/fega/ltp/aspects/PublishMQAspect.java index 51f8c25..056c112 100644 --- a/src/main/java/no/uio/ifi/ltp/aspects/PublishMQAspect.java +++ b/src/main/java/no/elixir/fega/ltp/aspects/PublishMQAspect.java @@ -1,10 +1,10 @@ -package no.uio.ifi.ltp.aspects; +package no.elixir.fega.ltp.aspects; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; -import no.uio.ifi.ltp.dto.EncryptedIntegrity; -import no.uio.ifi.ltp.dto.FileDescriptor; -import no.uio.ifi.ltp.dto.Operation; +import no.elixir.fega.ltp.dto.EncryptedIntegrity; +import no.elixir.fega.ltp.dto.FileDescriptor; +import no.elixir.fega.ltp.dto.Operation; import no.uio.ifi.tc.model.pojo.TSDFileAPIResponse; import org.apache.http.entity.ContentType; import org.aspectj.lang.annotation.AfterReturning; @@ -20,7 +20,7 @@ import java.util.Objects; import java.util.UUID; -import static no.uio.ifi.ltp.aspects.ProcessArgumentsAspect.*; +import static no.elixir.fega.ltp.aspects.ProcessArgumentsAspect.*; /** * AOP aspect that publishes MQ messages. @@ -58,7 +58,7 @@ public class PublishMQAspect { * @param result Object returned by the proxied method. */ @SuppressWarnings({"unchecked", "rawtypes"}) - @AfterReturning(pointcut = "execution(@org.springframework.web.bind.annotation.PatchMapping public * no.uio.ifi.ltp.controllers.rest.ProxyController.stream(..))", returning = "result") + @AfterReturning(pointcut = "execution(@org.springframework.web.bind.annotation.PatchMapping public * no.elixir.fega.ltp.controllers.rest.ProxyController.stream(..))", returning = "result") public void publishUpload(Object result) { ResponseEntity genericResponseEntity = (ResponseEntity) result; if (!String.valueOf(Objects.requireNonNull(genericResponseEntity).getStatusCode()).startsWith("20")) { @@ -97,7 +97,7 @@ public void publishUpload(Object result) { * @param result Object returned by the proxied method. */ @SuppressWarnings({"unchecked", "rawtypes"}) - @AfterReturning(pointcut = "execution(public * no.uio.ifi.ltp.controllers.rest.ProxyController.deleteFile(..))", returning = "result") + @AfterReturning(pointcut = "execution(public * no.elixir.fega.ltp.controllers.rest.ProxyController.deleteFile(..))", returning = "result") public void publishRemove(Object result) { ResponseEntity genericResponseEntity = (ResponseEntity) result; if (!String.valueOf(Objects.requireNonNull(genericResponseEntity).getStatusCode()).startsWith("20")) { diff --git a/src/main/java/no/uio/ifi/ltp/authentication/CEGACredentialsProvider.java b/src/main/java/no/elixir/fega/ltp/authentication/CEGACredentialsProvider.java similarity index 95% rename from src/main/java/no/uio/ifi/ltp/authentication/CEGACredentialsProvider.java rename to src/main/java/no/elixir/fega/ltp/authentication/CEGACredentialsProvider.java index cee7fa7..cab9dee 100644 --- a/src/main/java/no/uio/ifi/ltp/authentication/CEGACredentialsProvider.java +++ b/src/main/java/no/elixir/fega/ltp/authentication/CEGACredentialsProvider.java @@ -1,6 +1,6 @@ -package no.uio.ifi.ltp.authentication; +package no.elixir.fega.ltp.authentication; -import no.uio.ifi.ltp.dto.Credentials; +import no.elixir.fega.ltp.dto.Credentials; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cache.annotation.Cacheable; diff --git a/src/main/java/no/uio/ifi/ltp/controllers/rest/AuthController.java b/src/main/java/no/elixir/fega/ltp/controllers/rest/AuthController.java similarity index 97% rename from src/main/java/no/uio/ifi/ltp/controllers/rest/AuthController.java rename to src/main/java/no/elixir/fega/ltp/controllers/rest/AuthController.java index 209965d..2b0d1d3 100644 --- a/src/main/java/no/uio/ifi/ltp/controllers/rest/AuthController.java +++ b/src/main/java/no/elixir/fega/ltp/controllers/rest/AuthController.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.controllers.rest; +package no.elixir.fega.ltp.controllers.rest; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/no/uio/ifi/ltp/controllers/rest/ProxyController.java b/src/main/java/no/elixir/fega/ltp/controllers/rest/ProxyController.java similarity index 99% rename from src/main/java/no/uio/ifi/ltp/controllers/rest/ProxyController.java rename to src/main/java/no/elixir/fega/ltp/controllers/rest/ProxyController.java index 98698e1..c71f9fa 100644 --- a/src/main/java/no/uio/ifi/ltp/controllers/rest/ProxyController.java +++ b/src/main/java/no/elixir/fega/ltp/controllers/rest/ProxyController.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.controllers.rest; +package no.elixir.fega.ltp.controllers.rest; import lombok.extern.slf4j.Slf4j; import no.uio.ifi.tc.TSDFileAPIClient; diff --git a/src/main/java/no/uio/ifi/ltp/dto/Credentials.java b/src/main/java/no/elixir/fega/ltp/dto/Credentials.java similarity index 91% rename from src/main/java/no/uio/ifi/ltp/dto/Credentials.java rename to src/main/java/no/elixir/fega/ltp/dto/Credentials.java index 24234df..6ed02f5 100644 --- a/src/main/java/no/uio/ifi/ltp/dto/Credentials.java +++ b/src/main/java/no/elixir/fega/ltp/dto/Credentials.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.dto; +package no.elixir.fega.ltp.dto; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; diff --git a/src/main/java/no/uio/ifi/ltp/dto/EncryptedIntegrity.java b/src/main/java/no/elixir/fega/ltp/dto/EncryptedIntegrity.java similarity index 91% rename from src/main/java/no/uio/ifi/ltp/dto/EncryptedIntegrity.java rename to src/main/java/no/elixir/fega/ltp/dto/EncryptedIntegrity.java index cdb6f58..c7085f7 100644 --- a/src/main/java/no/uio/ifi/ltp/dto/EncryptedIntegrity.java +++ b/src/main/java/no/elixir/fega/ltp/dto/EncryptedIntegrity.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.dto; +package no.elixir.fega.ltp.dto; import com.google.gson.annotations.SerializedName; import lombok.Data; diff --git a/src/main/java/no/uio/ifi/ltp/dto/FileDescriptor.java b/src/main/java/no/elixir/fega/ltp/dto/FileDescriptor.java similarity index 95% rename from src/main/java/no/uio/ifi/ltp/dto/FileDescriptor.java rename to src/main/java/no/elixir/fega/ltp/dto/FileDescriptor.java index 5372b43..b93872d 100644 --- a/src/main/java/no/uio/ifi/ltp/dto/FileDescriptor.java +++ b/src/main/java/no/elixir/fega/ltp/dto/FileDescriptor.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.dto; +package no.elixir.fega.ltp.dto; import com.google.gson.annotations.SerializedName; import lombok.Data; diff --git a/src/main/java/no/uio/ifi/ltp/dto/Operation.java b/src/main/java/no/elixir/fega/ltp/dto/Operation.java similarity index 78% rename from src/main/java/no/uio/ifi/ltp/dto/Operation.java rename to src/main/java/no/elixir/fega/ltp/dto/Operation.java index baf79a7..70b8a74 100644 --- a/src/main/java/no/uio/ifi/ltp/dto/Operation.java +++ b/src/main/java/no/elixir/fega/ltp/dto/Operation.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp.dto; +package no.elixir.fega.ltp.dto; /** * Type of file event (created, moved, removed, etc.) diff --git a/src/test/java/no/uio/ifi/ltp/LocalEGATSDProxyApplicationTests.java b/src/test/java/no/elixir/fega/ltp/LocalEGATSDProxyApplicationTests.java similarity index 87% rename from src/test/java/no/uio/ifi/ltp/LocalEGATSDProxyApplicationTests.java rename to src/test/java/no/elixir/fega/ltp/LocalEGATSDProxyApplicationTests.java index e7f5a61..cfc8258 100644 --- a/src/test/java/no/uio/ifi/ltp/LocalEGATSDProxyApplicationTests.java +++ b/src/test/java/no/elixir/fega/ltp/LocalEGATSDProxyApplicationTests.java @@ -1,4 +1,4 @@ -package no.uio.ifi.ltp; +package no.elixir.fega.ltp; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest;