Browse Source

branch for release 3.9

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/common/common-gcube-calls/1.0@119521 82a268e6-3cf1-43bd-a215-b396298e98cf
smartgears_4
Lucio Lelii 7 years ago
parent
commit
78fa301056
  1. 4
      .classpath
  2. 7
      .settings/org.eclipse.jdt.core.prefs
  3. 5
      distro/README
  4. 4
      distro/changelog.xml
  5. 21
      pom.xml
  6. 31
      src/main/java/org/gcube/common/calls/interceptors/AuthorizationInterceptor.java
  7. 29
      src/main/java/org/gcube/common/calls/interceptors/CalledMethodInterceptor.java
  8. 11
      src/main/java/org/gcube/common/calls/interceptors/ScopeInterceptor.java
  9. 4
      src/main/resources/META-INF/services/org.gcube.common.calls.Interceptor

4
.classpath

@ -22,12 +22,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

7
.settings/org.eclipse.jdt.core.prefs

@ -1,13 +1,12 @@
#Fri Oct 11 15:08:46 CEST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7

5
distro/README

@ -1,8 +1,9 @@
The gCube System - ${name}
----------------------
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2),
D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2),
and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1).
Authors
-------

4
distro/changelog.xml

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="${build.finalName}" date="2015-09-24">
<Change>MethodInterceptor added</Change>
<Change>AuthorizationInterceptor added</Change>
</Changeset>
<Changeset component="${build.finalName}" date="2013-10-24">
<Change>First Release</Change>
</Changeset>

21
pom.xml

@ -1,16 +1,16 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.core</groupId>
<artifactId>common-gcube-calls</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
<properties>
<distroDirectory>distro</distroDirectory>
@ -23,6 +23,11 @@
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
@ -34,7 +39,7 @@
<version>1.7.5</version>
</dependency>
</dependencies>
<build>
<plugins>

31
src/main/java/org/gcube/common/calls/interceptors/AuthorizationInterceptor.java

@ -0,0 +1,31 @@
package org.gcube.common.calls.interceptors;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.calls.Call;
import org.gcube.common.calls.Interceptor;
import org.gcube.common.calls.Request;
import org.gcube.common.calls.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AuthorizationInterceptor implements Interceptor {
private Logger logger = LoggerFactory.getLogger(AuthorizationInterceptor.class);
public static final String token_header="gcube-token";
@Override
public void handleRequest(Request request, Call call) {
String token = SecurityTokenProvider.instance.get();
if (token==null)
logger.warn("security token is not set");
else{
request.addHeader(token_header, token);
logger.trace("security token set in the header is "+token);
}
}
@Override
public void handleResponse(Response context, Call callContext) {}
}

29
src/main/java/org/gcube/common/calls/interceptors/CalledMethodInterceptor.java

@ -0,0 +1,29 @@
package org.gcube.common.calls.interceptors;
import org.gcube.common.authorization.library.provider.CalledMethodProvider;
import org.gcube.common.calls.Call;
import org.gcube.common.calls.Interceptor;
import org.gcube.common.calls.Request;
import org.gcube.common.calls.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CalledMethodInterceptor implements Interceptor {
private Logger logger = LoggerFactory.getLogger(CalledMethodInterceptor.class);
public static final String calledMethodHeader="gcube-method";
@Override
public void handleRequest(Request request, Call call) {
String calledMethod = CalledMethodProvider.instance.get();
request.addHeader(calledMethodHeader, calledMethod);
logger.trace("called method set in the header is "+calledMethod);
}
@Override
public void handleResponse(Response context, Call callContext) {}
}

11
src/main/java/org/gcube/common/calls/interceptors/ScopeInterceptor.java

@ -19,12 +19,11 @@ public class ScopeInterceptor implements Interceptor {
String scope = ScopeProvider.instance.get();
if (scope==null)
throw new RuntimeException("call is unscoped");
request.addHeader(scope_header, scope);
logger.trace("scope set in the header is "+scope);
logger.warn("scope is not set in this call");
else{
request.addHeader(scope_header, scope);
logger.trace("scope set in the header is "+scope);
}
}
public void handleResponse(Response context, Call callContext) {}

4
src/main/resources/META-INF/services/org.gcube.common.calls.Interceptor

@ -1 +1,3 @@
org.gcube.common.calls.interceptors.ScopeInterceptor
org.gcube.common.calls.interceptors.ScopeInterceptor
org.gcube.common.calls.interceptors.AuthorizationInterceptor
org.gcube.common.calls.interceptors.CalledMethodInterceptor
Loading…
Cancel
Save