diff --git a/.classpath b/.classpath
index 1d05ba3..11f5b86 100644
--- a/.classpath
+++ b/.classpath
@@ -1,19 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -24,5 +11,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index cac0df4..29fe717 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,11 @@
eclipse.preferences.version=1
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.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.compliance=11
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.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.source=11
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
new file mode 100644
index 0000000..c7925ef
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..54a5299
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..04cad8c
--- /dev/null
+++ b/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
diff --git a/distro/LICENSE b/distro/LICENSE
deleted file mode 100644
index 3695e26..0000000
--- a/distro/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-${gcube.license}
diff --git a/distro/README b/distro/README
deleted file mode 100644
index 8055c89..0000000
--- a/distro/README
+++ /dev/null
@@ -1,64 +0,0 @@
-The gCube System - ${name}
---------------------------------------------------
-
-${description}
-
-
-${gcube.description}
-
-${gcube.funding}
-
-
-Version
---------------------------------------------------
-
-${version} (${buildDate})
-
-Please see the file named "changelog.xml" in this directory for the release notes.
-
-Authors
---------------------------------------------------
-
-* Lucio Lelii (lucio.lelii-AT-isti.cnr.it), CNR, Italy
-
-Maintainers
---------------------------------------------------
-
-* Lucio Lelii (lucio.lelii-AT-isti.cnr.it), CNR, Italy
-
-Download information
---------------------------------------------------
-
-Source code is available from SVN:
- ${scm.url}
-
-Binaries can be downloaded from the gCube website:
- ${gcube.website}
-
-
-Installation
---------------------------------------------------
-
-Installation documentation is available on-line in the gCube Wiki:
- ${gcube.wikiRoot}
-
-Documentation
---------------------------------------------------
-
-Documentation is available on-line in the gCube Wiki:
- ${gcube.wikiRoot}
-
-Support
---------------------------------------------------
-
-Bugs and support requests can be reported in the gCube issue tracking tool:
- ${gcube.issueTracking}
-
-
-Licensing
---------------------------------------------------
-
-This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
-
-
-
diff --git a/distro/changelog.xml b/distro/changelog.xml
deleted file mode 100644
index db267d7..0000000
--- a/distro/changelog.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- First Release
-
-
\ No newline at end of file
diff --git a/distro/descriptor.xml b/distro/descriptor.xml
deleted file mode 100644
index 50e73a4..0000000
--- a/distro/descriptor.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
- servicearchive
-
- tar.gz
-
- /
-
-
- ${distroDirectory}
- /
- true
-
- README
- LICENSE
- changelog.xml
- profile.xml
-
- 755
- true
-
-
-
-
-
-
- /${artifactId}
-
-
-
diff --git a/distro/profile.xml b/distro/profile.xml
deleted file mode 100644
index 91c49e4..0000000
--- a/distro/profile.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- Service
-
- ${description}
- Common
- ${artifactId}
- 1.0.0
-
-
- ${artifactId}
- ${version}
-
- ${groupId}
- ${artifactId}
- ${version}
-
-
- ${build.finalName}.jar
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 5bfa979..49de1e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
maven-parent
org.gcube.tools
- 1.1.0
+ 1.2.0
scm:git:https://code-repo.d4science.org/gCubeSystem/authorization-control-library.git
@@ -20,16 +20,16 @@
- 1.8
- 1.8
+ 11
+ 11
org.gcube.distribution
- gcube-bom
- 3.0.0-SNAPSHOT
+ gcube-smartgears-bom
+ 3.0.1-SNAPSHOT
pom
import
@@ -41,12 +41,21 @@
org.gcube.common
common-security
+
+ org.gcube.core
+ common-smartgears
+
org.aspectj
aspectjrt
- 1.8.2
+ 1.9.7
-
+
+
+ javax.ws.rs
+ javax.ws.rs-api
+
+
org.slf4j
slf4j-api
@@ -85,9 +94,9 @@
org.codehaus.mojo
aspectj-maven-plugin
- 1.8
-
- 1.8
+ 11
+
+ 11
@@ -104,56 +113,12 @@
org.codehaus.mojo
aspectj-maven-plugin
+ 1.14.0
org.apache.maven.plugins
maven-compiler-plugin
-
- org.apache.maven.plugins
- maven-resources-plugin
- 2.5
-
-
- copy-profile
- install
-
- copy-resources
-
-
- target
-
-
- .
- true
-
- profile.xml
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- descriptor.xml
-
-
-
-
- servicearchive
- install
-
- single
-
-
-
-
\ No newline at end of file
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 6500f53..6be64c2 100644
--- a/src/main/java/org/gcube/common/authorization/control/AuthorizationAspect.java
+++ b/src/main/java/org/gcube/common/authorization/control/AuthorizationAspect.java
@@ -38,9 +38,9 @@ public class AuthorizationAspect {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
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());
+ log.info("aspect before with annotation {} allowed role {} and allowed users {} in method {}", authAnn.annotationType(), authAnn.allowedRoles(), authAnn.allowedUsers(), method.getName());
- Owner user = SecretManagerProvider.instance.get().getOwner();
+ Owner user = SecretManagerProvider.get().getOwner();
String userId = user.getId();
Collection userRoles = user.getRoles();
diff --git a/src/main/java/org/gcube/common/authorization/control/annotations/AuthorizationControl.java b/src/main/java/org/gcube/common/authorization/control/annotations/AuthorizationControl.java
index 9e18878..8621ec4 100644
--- a/src/main/java/org/gcube/common/authorization/control/annotations/AuthorizationControl.java
+++ b/src/main/java/org/gcube/common/authorization/control/annotations/AuthorizationControl.java
@@ -6,14 +6,15 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import org.gcube.common.authorization.control.exception.DefaultAuthorizationException;
+
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface AuthorizationControl {
- String[] actions() default {};
String[] allowedUsers() default {};
String[] allowedRoles() default {};
- Class extends RuntimeException> exception();
+ Class extends RuntimeException> exception() default DefaultAuthorizationException.class;
}
diff --git a/src/main/java/org/gcube/common/authorization/control/exception/DefaultAuthorizationException.java b/src/main/java/org/gcube/common/authorization/control/exception/DefaultAuthorizationException.java
new file mode 100644
index 0000000..c1f2c40
--- /dev/null
+++ b/src/main/java/org/gcube/common/authorization/control/exception/DefaultAuthorizationException.java
@@ -0,0 +1,16 @@
+package org.gcube.common.authorization.control.exception;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response.Status;
+
+public class DefaultAuthorizationException extends WebApplicationException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public DefaultAuthorizationException(Throwable cause) {
+ super(cause, Status.FORBIDDEN);
+ }
+
+}
\ No newline at end of file