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 9 years ago
parent 50835f635d
commit 78fa301056

@ -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>

@ -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

@ -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
-------

@ -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>

@ -10,7 +10,7 @@
<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>

@ -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) {}
}

@ -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) {}
}

@ -19,12 +19,11 @@ public class ScopeInterceptor implements Interceptor {
String scope = ScopeProvider.instance.get();
if (scope==null)
throw new RuntimeException("call is unscoped");
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) {}

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