diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 4e4a3ad..cac0df4 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -3,7 +3,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f6b75e7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.0-SNAPSHOT] - [2022-04-20] + +- moving to smartgears 4.0.0 + +## [v1.1.1] - [2018-12-03] + +First commit \ No newline at end of file diff --git a/FUNDING.md b/FUNDING.md new file mode 100644 index 0000000..6fa9eac --- /dev/null +++ b/FUNDING.md @@ -0,0 +1,26 @@ +# Acknowledgments + +The projects leading to this software have received funding from a series of European Union programmes including: + +- the Sixth Framework Programme for Research and Technological Development + - [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260). +- the Seventh Framework Programme for research, technological development and demonstration + - [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488); + - [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019); + - [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465); + - [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644); + - [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754). +- the H2020 research and innovation programme + - [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024); + - [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119); + - [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142); + - [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182); + - [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680); + - [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610); + - [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001); + - [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194); + - [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914); + - [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091); + - [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650); + - [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409); + - [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042); \ No newline at end of file diff --git a/changelog.xml b/changelog.xml deleted file mode 100644 index db267d7..0000000 --- a/changelog.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - First Release - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9b34a88..c9f8abf 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.gcube.common authorization-control-library - 1.1.1 + 2.0.0-SNAPSHOT Authorization Control Library Authorization Control Library @@ -20,7 +20,7 @@ org.gcube.common common-authorization - [2.0.0, 3.0.0-SNAPSHOT) + [3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT) org.aspectj diff --git a/src/main/java/org/gcube/common/authorization/control/AuthorizationAspect.java b/src/main/java/org/gcube/common/authorization/control/AuthorizationAspect.java index d284a24..cc84718 100644 --- a/src/main/java/org/gcube/common/authorization/control/AuthorizationAspect.java +++ b/src/main/java/org/gcube/common/authorization/control/AuthorizationAspect.java @@ -4,6 +4,7 @@ package org.gcube.common.authorization.control; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -14,7 +15,8 @@ import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.gcube.common.authorization.control.annotations.AuthorizationControl; import org.gcube.common.authorization.library.exception.AuthorizationException; -import org.gcube.common.authorization.library.provider.AuthorizationProvider; +import org.gcube.common.authorization.utils.manager.SecretManagerProvider; +import org.gcube.common.authorization.utils.user.User; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,9 +40,12 @@ public class AuthorizationAspect { Method method = signature.getMethod(); AuthorizationControl authAnn = (AuthorizationControl) method.getAnnotation(AuthorizationControl.class); log.info("aspect before with annotation {} with action {}, allowed {} in method {}", authAnn.annotationType(), authAnn.actions(), authAnn.allowedRoles(), authAnn.allowedUsers(), method.getName()); - String userId = AuthorizationProvider.instance.get().getClient().getId(); - List userRoles = AuthorizationProvider.instance.get().getClient().getRoles(); + + User user = SecretManagerProvider.instance.get().getUser(); + String userId = user.getUsername(); + Collection userRoles = user.getRoles(); + log.info("user role is {} and user {}", userRoles, userId ); if (authAnn.allowedUsers().length!=0 && !Arrays.asList(authAnn.allowedUsers()).contains(userId)) { RuntimeException ex = authAnn.exception().getConstructor(Throwable.class).newInstance(new AuthorizationException(String.format("user %s not allowed to call method %s", userId, method.getName()))); throw ex;