2012-09-12 12:47:59 +02:00
|
|
|
package org.gcube.application.framework.core.security;
|
|
|
|
|
|
|
|
import java.rmi.Remote;
|
|
|
|
|
|
|
|
import org.gcube.application.framework.core.session.ASLSession;
|
2013-08-22 12:28:07 +02:00
|
|
|
import org.gcube.soa3.connector.common.security.CredentialManager;
|
|
|
|
import org.gcube.soa3.connector.common.security.Credentials;
|
|
|
|
//import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
|
|
|
//import org.gcube.common.core.scope.GCUBEScope;
|
|
|
|
//import org.gcube.common.core.scope.GCUBEScope.MalformedScopeExpressionException;
|
|
|
|
//import org.gcube.common.core.security.GCUBESecurityManager;
|
2012-09-12 12:47:59 +02:00
|
|
|
import org.ietf.jgss.GSSCredential;
|
|
|
|
|
2013-09-03 11:43:58 +02:00
|
|
|
/**
|
|
|
|
* SHOULD RECODE CLASS THE FUNCTIONS, USING THE NEW FEATHERWEIGHT SECURITY MODEL
|
|
|
|
*
|
|
|
|
* @author nikolas
|
|
|
|
*
|
|
|
|
* @param <PORTTYPE>
|
|
|
|
*/
|
2012-09-12 12:47:59 +02:00
|
|
|
public class ServiceContextManager<PORTTYPE extends Remote> {
|
|
|
|
|
2013-09-03 11:43:58 +02:00
|
|
|
//TODO: SHOULD RECODE THE FUNCTIONS, USING THE NEW FEATHERWEIGHT SECURITY MODEL
|
|
|
|
/*
|
|
|
|
public static <PORTTYPE extends Remote> PORTTYPE applySecurity(PORTTYPE stub, ASLSession session) throws Exception{
|
2013-08-22 12:28:07 +02:00
|
|
|
Credentials credentials = CredentialManager.instance.get();
|
2012-09-12 12:47:59 +02:00
|
|
|
GCUBESecurityManager secManager = new PortalSecurityManager(session);
|
|
|
|
if(secManager.isSecurityEnabled())
|
|
|
|
secManager.useCredentials(session.getCredential());
|
|
|
|
return GCUBERemotePortTypeContext.getProxy(stub , session.getScope(), secManager);
|
|
|
|
}
|
|
|
|
|
2013-09-03 11:43:58 +02:00
|
|
|
public static <PORTTYPE extends Remote> PORTTYPE applySecurity(PORTTYPE stub, String scope, GSSCredential cred) throws Exception{
|
2012-09-12 12:47:59 +02:00
|
|
|
GCUBESecurityManager secManager = new PortalSecurityManager(scope);
|
|
|
|
if(secManager.isSecurityEnabled())
|
|
|
|
secManager.useCredentials(cred);
|
|
|
|
return GCUBERemotePortTypeContext.getProxy(stub , scope, secManager);
|
|
|
|
}
|
2013-09-03 11:43:58 +02:00
|
|
|
*/
|
2012-09-12 12:47:59 +02:00
|
|
|
|
|
|
|
}
|