git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerCore@4674 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4b5ac604d6
commit
9c006d7c9b
|
@ -5,8 +5,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -56,7 +56,7 @@ public class ContentInfoCacheEntryFactory implements CacheEntryFactory {
|
|||
CMSPortType1ServiceAddressingLocator serviceLocator = new CMSPortType1ServiceAddressingLocator();
|
||||
CMSPortType1PortType cms = serviceLocator.getCMSPortType1PortTypePort(serviceEPR);
|
||||
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(GCUBEScope.getScope(query.get(CacheEntryConstants.dl)));
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -63,7 +63,7 @@ public class MetadataCacheEntryFactory implements CacheEntryFactory {
|
|||
}
|
||||
|
||||
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(GCUBEScope.getScope(query.get(CacheEntryConstants.dl)));
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.apache.axis.message.addressing.Address;
|
|||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.commons.ProfileService;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -55,7 +55,7 @@ public class ProfileCacheEntryFactory implements CacheEntryFactory {
|
|||
{
|
||||
System.out.println("Scope=" + GCUBEScope.getScope(query.get(CacheEntryConstants.dl)));
|
||||
ProfileService profileService = new ProfileService(query.get(CacheEntryConstants.username), GCUBEScope.getScope(query.get(CacheEntryConstants.dl)));
|
||||
ExtendedGSSCredential cred = (new PortalSecurityManager().isSecurityEnabled())?ApplicationCredentials.getInstance().getCredential(CacheEntryConstants.dl):null;
|
||||
ExtendedGSSCredential cred = (new PortalSecurityManager(GCUBEScope.getScope(query.get(CacheEntryConstants.dl))).isSecurityEnabled())?ApplicationCredentials.getInstance().getCredential(CacheEntryConstants.dl):null;
|
||||
UserProfileAccessPortType port = profileService.getUserProfileAccess(cred);
|
||||
profile = port.getUserProfile(new VOID()); // this is the profile!!!
|
||||
System.out.println(profile);
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManager;
|
||||
|
@ -54,7 +54,7 @@ public class SearchConfigCacheEntryFactory implements CacheEntryFactory {
|
|||
SearchMasterServiceAddressingLocator serviceLocator = new SearchMasterServiceAddressingLocator();
|
||||
SearchMasterPortType searchMaster = serviceLocator.getSearchMasterPortTypePort(serviceEPR);
|
||||
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(GCUBEScope.getScope(key.toString()));
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.faults.GCUBEFault;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -85,7 +85,7 @@ public class ProfileService {
|
|||
{
|
||||
UserProfileAccessFactoryPortType upa = getUserProfileAccessFactory();
|
||||
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(scope);
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
@ -131,7 +131,7 @@ public class ProfileService {
|
|||
*/
|
||||
public UserProfileAccessPortType getUserProfileAccess(UserProfileAccessFactoryPortType upa, ExtendedGSSCredential cred)
|
||||
{
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(scope);
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
@ -182,7 +182,7 @@ public class ProfileService {
|
|||
port = instanceLocator.getUserProfileAccessPortTypePort(epr);
|
||||
|
||||
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(scope);
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
@ -226,7 +226,7 @@ public class ProfileService {
|
|||
serviceEPR.setAddress(new Address(profileURIs[profileId.getAndIncrement()%profileURIs.length]));
|
||||
ProfileAdministrationServiceAddressingLocator palocator = new ProfileAdministrationServiceAddressingLocator();
|
||||
pa = palocator.getProfileAdministrationPortTypePort(serviceEPR);
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(scope);
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
secManager.useCredentials(cred);
|
||||
|
|
|
@ -49,7 +49,7 @@ public interface DigitalObjectInfoI {
|
|||
/**
|
||||
* @return the metadata
|
||||
*/
|
||||
public BaseMetadata getMetadata(String schema);
|
||||
public String getMetadata(String schema);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,10 +15,10 @@ import org.gcube.application.framework.core.cache.CachesManager;
|
|||
import org.gcube.application.framework.core.cache.HarvestersManager;
|
||||
import org.gcube.application.framework.core.commons.model.CollectionInfo;
|
||||
import org.gcube.application.framework.core.content.DigitalObjectInfoI;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.FindInfo;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
|
@ -121,13 +121,13 @@ public class DigitalObject implements DigitalObjectInfoI {
|
|||
/* (non-Javadoc)
|
||||
* @see org.gcube.application.framework.DigitalObjectInfoI#getMetadata(java.lang.String)
|
||||
*/
|
||||
public BaseMetadata getMetadata(String schema) {
|
||||
public String getMetadata(String schema) {
|
||||
try {
|
||||
QueryString query = new QueryString();
|
||||
query.addParameter(CacheEntryConstants.dl, session.getScopeName());
|
||||
query.addParameter(CacheEntryConstants.oid, oid);
|
||||
query.addParameter(CacheEntryConstants.metadataColID, colInfo.getMetadataID(colInfo.getIndexOfSchema(schema)));
|
||||
return (BaseMetadata) CachesManager.getInstance().getMetadataCache().get(query).getValue();
|
||||
return (String) CachesManager.getInstance().getMetadataCache().get(query).getValue();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ public class DigitalObject implements DigitalObjectInfoI {
|
|||
CMSPortType1ServiceAddressingLocator cmslocator = new CMSPortType1ServiceAddressingLocator();
|
||||
cms = cmslocator.getCMSPortType1PortTypePort(endpoint);
|
||||
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager();
|
||||
GCUBESecurityManager secManager = new PortalSecurityManager(session);
|
||||
if(secManager.isSecurityEnabled())
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package org.gcube.application.framework.core.security;
|
||||
|
||||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
|
||||
/**
|
||||
* @author Valia Tsagkalidou (KNUA)
|
||||
*
|
||||
*/
|
||||
public class PortalSecurityManager extends GCUBESecurityManagerImpl {
|
||||
|
||||
public PortalSecurityManager(GCUBEScope scope) {
|
||||
super();
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public PortalSecurityManager(D4ScienceSession session) {
|
||||
super();
|
||||
this.scope = session.getScope();
|
||||
}
|
||||
|
||||
GCUBEScope scope;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSecurityEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.application.framework.core.cache.CachesManager;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.application.framework.core.util.UserCredential;
|
||||
import org.gcube.common.core.scope.GCUBEScope;
|
||||
|
@ -175,7 +175,7 @@ public class D4ScienceSession{
|
|||
public void setScope(String scope) {
|
||||
lastUsedTime = System.currentTimeMillis();
|
||||
this.scope = GCUBEScope.getScope(scope.trim().toLowerCase());
|
||||
if(new PortalSecurityManager().isSecurityEnabled())
|
||||
if(new PortalSecurityManager(this.scope).isSecurityEnabled())
|
||||
this.credential = UserCredential.getCredential(username, scope);
|
||||
innerSession.clear();
|
||||
initializeAttributes();
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package org.gcube.application.framework.core.util;
|
||||
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
|
||||
/**
|
||||
* @author Valia Tsagkalidou (KNUA)
|
||||
*
|
||||
*/
|
||||
public class PortalSecurityManager extends GCUBESecurityManagerImpl {
|
||||
|
||||
@Override
|
||||
public boolean isSecurityEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,10 +16,10 @@ import javax.xml.xpath.XPathExpressionException;
|
|||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.gcube.application.framework.core.cache.CachesManager;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.application.framework.core.util.CacheEntryConstants;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.util.QueryString;
|
||||
import org.gcube.application.framework.core.util.SessionConstants;
|
||||
import org.gcube.application.framework.core.vremanagement.GenericResourceInfoI;
|
||||
|
@ -133,7 +133,7 @@ public class GenericResource implements GenericResourceInfoI{
|
|||
gCubeRes.setDescription(genericResource.getDescription());
|
||||
gCubeRes.setBody(genericResource.getBody());
|
||||
|
||||
String Gr = publisher.registerGCUBEResource(gCubeRes, session.getScope(), new PortalSecurityManager());
|
||||
String Gr = publisher.registerGCUBEResource(gCubeRes, session.getScope(), new PortalSecurityManager(session));
|
||||
Document doc = parseXMLFileToDOM(Gr);
|
||||
XPath xpath = XPathFactory.newInstance().newXPath();
|
||||
try {
|
||||
|
@ -163,7 +163,7 @@ public class GenericResource implements GenericResourceInfoI{
|
|||
gCubeRes.setName(genericResource.getName());
|
||||
gCubeRes.setDescription(genericResource.getDescription());
|
||||
gCubeRes.setBody(genericResource.getBody());
|
||||
publisher.updateGCUBEResource(gCubeRes, session.getScope(), new PortalSecurityManager());
|
||||
publisher.updateGCUBEResource(gCubeRes, session.getScope(), new PortalSecurityManager(session));
|
||||
List<ISGenericResource> genRes = new ArrayList<ISGenericResource>();
|
||||
genRes.add(genericResource);
|
||||
QueryString query = new QueryString();
|
||||
|
@ -262,7 +262,7 @@ public class GenericResource implements GenericResourceInfoI{
|
|||
public void removeGenericResource(ISGenericResource genericResource)
|
||||
throws RemoteException {
|
||||
try {
|
||||
publisher.removeGCUBEResource(genericResource.getId(), GCUBEGenericResource.TYPE, session.getScope(), new PortalSecurityManager());
|
||||
publisher.removeGCUBEResource(genericResource.getId(), GCUBEGenericResource.TYPE, session.getScope(), new PortalSecurityManager(session));
|
||||
|
||||
QueryString query = new QueryString();
|
||||
query.addParameter(CacheEntryConstants.id, genericResource.getId());
|
||||
|
|
|
@ -7,8 +7,8 @@ import java.util.List;
|
|||
|
||||
import org.apache.axis.message.addressing.Address;
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.vremanagement.ISInfoI;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
|
@ -107,7 +107,7 @@ public class ISInfo implements ISInfoI {
|
|||
*/
|
||||
public void addGHNToScope(String url) {
|
||||
//TODO: this will probably change...
|
||||
GCUBESecurityManagerImpl managerSec = new PortalSecurityManager();
|
||||
GCUBESecurityManagerImpl managerSec = new PortalSecurityManager(session);
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
try {
|
||||
|
@ -127,7 +127,7 @@ public class ISInfo implements ISInfoI {
|
|||
|
||||
public void removeGHNToScope(String url) {
|
||||
//TODO: this will probably change...
|
||||
GCUBESecurityManagerImpl managerSec = new PortalSecurityManager();
|
||||
GCUBESecurityManagerImpl managerSec = new PortalSecurityManager(session);
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
try {
|
||||
|
@ -147,7 +147,7 @@ public class ISInfo implements ISInfoI {
|
|||
*/
|
||||
public void addRIToScope(String url, String className, String name) {
|
||||
//TODO: this will probably change...
|
||||
GCUBESecurityManagerImpl managerSec = new PortalSecurityManager();
|
||||
GCUBESecurityManagerImpl managerSec = new PortalSecurityManager(session);
|
||||
|
||||
EndpointReferenceType endpoint = new EndpointReferenceType();
|
||||
try {
|
||||
|
@ -197,7 +197,7 @@ public class ISInfo implements ISInfoI {
|
|||
try {
|
||||
// TODO Change this
|
||||
|
||||
publisher.registerGCUBEResource(ri, session.getScope(), new PortalSecurityManager());
|
||||
publisher.registerGCUBEResource(ri, session.getScope(), new PortalSecurityManager(session));
|
||||
} catch (ISPublisherException e) {
|
||||
String message = "Registration error for the External Running Instance with id=" + ri.getID() + "\n";
|
||||
System.out.println(message);
|
||||
|
@ -213,7 +213,7 @@ public class ISInfo implements ISInfoI {
|
|||
try {
|
||||
// TODO Change this
|
||||
|
||||
publisher.removeGCUBEResource(id, GCUBEExternalRunningInstance.TYPE, session.getScope(), new PortalSecurityManager());
|
||||
publisher.removeGCUBEResource(id, GCUBEExternalRunningInstance.TYPE, session.getScope(), new PortalSecurityManager(session));
|
||||
} catch (ISPublisherException e) {
|
||||
String message = "Registration error for the External Running Instance with id=" +id + "\n";
|
||||
System.out.println(message);
|
||||
|
|
|
@ -3,25 +3,30 @@ package org.gcube.application.framework.core.vremanagement.impl;
|
|||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.application.framework.core.vremanagement.SoftwareRepositoryI;
|
||||
|
||||
/**
|
||||
* @author Valia Tsagkalidou (KNUA)
|
||||
*
|
||||
*/
|
||||
public class SoftwareRepository implements SoftwareRepositoryI{
|
||||
|
||||
/**
|
||||
*
|
||||
* the D4Science Session to use
|
||||
*/
|
||||
protected D4ScienceSession session;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param session
|
||||
* @param session the D4Science Session to use
|
||||
*/
|
||||
public SoftwareRepository(D4ScienceSession session) {
|
||||
super();
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.application.framework.SoftwareRepositoryI#store(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public String store(String serviceClass, String serviceName,
|
||||
String serviceVersion, String URL, String description) {
|
||||
|
@ -29,8 +34,8 @@ public class SoftwareRepository implements SoftwareRepositoryI{
|
|||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.application.framework.SoftwareRepositoryI#listPending()
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public String listPending() {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.gcube.application.framework.core.vremanagement.impl;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.application.framework.core.security.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.session.D4ScienceSession;
|
||||
import org.gcube.application.framework.core.util.PortalSecurityManager;
|
||||
import org.gcube.application.framework.core.vremanagement.VREGeneratorI;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.security.GCUBESecurityManagerImpl;
|
||||
|
@ -31,7 +31,7 @@ public class VREGenerator implements VREGeneratorI{
|
|||
|
||||
D4ScienceSession session;
|
||||
ModelerServicePortType modelPortType;
|
||||
static GCUBESecurityManagerImpl managerSec = new PortalSecurityManager();
|
||||
GCUBESecurityManagerImpl managerSec;
|
||||
|
||||
|
||||
|
||||
|
@ -43,6 +43,7 @@ public class VREGenerator implements VREGeneratorI{
|
|||
super();
|
||||
this.session = session;
|
||||
modelPortType = deserializeEPR(epr);
|
||||
managerSec = new PortalSecurityManager(session);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue