Added alternative user tokens
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@158409 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e4bcd8f1b9
commit
a3de8cee21
|
@ -10,7 +10,10 @@ import java.util.Properties;
|
|||
import org.gcube.common.authorization.client.Constants;
|
||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.common.authorization.library.AuthorizationEntry;
|
||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||
import org.gcube.common.authorization.library.provider.ClientInfo;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -39,7 +42,12 @@ public class ScopedTest {
|
|||
public static final String GCUBE_DEVSEC_DEVVRE_VARNAME = "GCUBE_DEVSEC_DEVVRE";
|
||||
public static final String GCUBE_DEVSEC_DEVVRE;
|
||||
|
||||
|
||||
private static final String GCUBE_DEVNEXT_ANOTHER_USER_VARNAME = "GCUBE_DEVNEXT_ANOTHER_USER";
|
||||
public static final String GCUBE_DEVNEXT_ANOTHER_USER;
|
||||
|
||||
public static final String DEFAULT_TEST_SCOPE;
|
||||
public static final String DEFAULT_TEST_SCOPE_ANOTHER_USER;
|
||||
public static final String ALTERNATIVE_TEST_SCOPE;
|
||||
|
||||
static {
|
||||
|
@ -59,7 +67,11 @@ public class ScopedTest {
|
|||
GCUBE_DEVSEC = properties.getProperty(GCUBE_DEVSEC_VARNAME);
|
||||
GCUBE_DEVSEC_DEVVRE = properties.getProperty(GCUBE_DEVSEC_DEVVRE_VARNAME);
|
||||
|
||||
GCUBE_DEVNEXT_ANOTHER_USER = properties.getProperty(GCUBE_DEVNEXT_ANOTHER_USER_VARNAME);
|
||||
|
||||
|
||||
DEFAULT_TEST_SCOPE = GCUBE_DEVNEXT;
|
||||
DEFAULT_TEST_SCOPE_ANOTHER_USER = GCUBE_DEVNEXT_ANOTHER_USER;
|
||||
ALTERNATIVE_TEST_SCOPE = GCUBE_DEVNEXT_NEXTNEXT;
|
||||
}
|
||||
|
||||
|
@ -73,6 +85,11 @@ public class ScopedTest {
|
|||
|
||||
public static void setContext(String token) throws ObjectNotFound, Exception{
|
||||
SecurityTokenProvider.instance.set(token);
|
||||
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
|
||||
ClientInfo clientInfo = authorizationEntry.getClientInfo();
|
||||
String qualifier = authorizationEntry.getQualifier();
|
||||
Caller caller = new Caller(clientInfo, qualifier);
|
||||
AuthorizationProvider.instance.set(caller);
|
||||
ScopeProvider.instance.set(getCurrentScope(token));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue