org.gcube.common.core.security
Class GCUBESecurityManagerImpl

java.lang.Object
  extended by org.gcube.common.core.security.GCUBESecurityManagerImpl
All Implemented Interfaces:
GCUBESecurityManager

public abstract class GCUBESecurityManagerImpl
extends Object
implements GCUBESecurityManager

Partial implementation of GCUBESecurityManager. Subclasses must implement isSecurityEnabled() to discriminate between secure and unsecure contexts.

Author:
Fabio Simeoni (University of Strathclyde), Manuele Simi (CNR)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.gcube.common.core.security.GCUBESecurityManager
GCUBESecurityManager.AuthMethod, GCUBESecurityManager.AuthMode, GCUBESecurityManager.DelegationMode
 
Field Summary
protected  GCUBESecurityManager.AuthMethod authMethod
           
protected  Map<Thread,GSSCredential> callCredentials
          Cache of credentials indexed by thread id.
protected  GCUBELog logger
          Object logger.
protected  String name
          The name of the manager.
 
Constructor Summary
GCUBESecurityManagerImpl()
           
 
Method Summary
 SecurityCredentials getCredentials()
          It returns the credentials for outgoing calls currently set in the current thread.
protected  String getName()
          Returns the name with which the manager should log events.
abstract  boolean isSecurityEnabled()
          Indicates whether the manager is operating in a secure context.
 void setAuthMethod(GCUBESecurityManager.AuthMethod m)
          Adds an authentication method to be used in this security context
 void setLogger(GCUBELog logger)
          Sets the manager's logger.
protected  void setName(String name)
          Sets the name with which the manager should log events
 void setSecurity(Remote s, GCUBESecurityManager.AuthMode e, GCUBESecurityManager.DelegationMode d)
          If security is enabled, sets the desired level of encryption and the mode of credential delegation on the stub of a remote porttype.
 void useCredentials(GSSCredential credentials)
          Deprecated. 
 void useCredentials(SecurityCredentials credentials)
          If security is enabled, it sets given credentials for outgoing calls in the current thread.
 void useCredentials(Thread thread, GSSCredential... credentials)
          Deprecated. 
 void useCredentials(Thread thread, SecurityCredentials... credentials)
          If security is enabled, it sets given credentials for outgoing calls in a given thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected GCUBELog logger
Object logger.


callCredentials

protected Map<Thread,GSSCredential> callCredentials
Cache of credentials indexed by thread id.


name

protected String name
The name of the manager.


authMethod

protected GCUBESecurityManager.AuthMethod authMethod
Constructor Detail

GCUBESecurityManagerImpl

public GCUBESecurityManagerImpl()
Method Detail

setLogger

public void setLogger(GCUBELog logger)
Sets the manager's logger.

Parameters:
logger - the logger.

getName

protected String getName()
Returns the name with which the manager should log events. If it is not overridden, the manager logs for itself.

Returns:
the name.

setName

protected void setName(String name)
Sets the name with which the manager should log events

Parameters:
name - the name

isSecurityEnabled

public abstract boolean isSecurityEnabled()
Indicates whether the manager is operating in a secure context. If not, invoking its methods will have no effect.

Specified by:
isSecurityEnabled in interface GCUBESecurityManager
Returns:
true if security is enabled, false otherwise.

useCredentials

@Deprecated
public void useCredentials(GSSCredential credentials)
                    throws Exception
Deprecated. 

Deprecated method used for backward compatibility: use useCredentials(SecurityCredentials credentials)

Specified by:
useCredentials in interface GCUBESecurityManager
Parameters:
credentials -
Throws:
Exception

useCredentials

@Deprecated
public void useCredentials(Thread thread,
                                      GSSCredential... credentials)
                    throws Exception
Deprecated. 

Deprecated method used for backward compatibility: use useCredentials(Thread thread, SecurityCredentials ... credentials)

Parameters:
credentials -
Throws:
Exception

useCredentials

public void useCredentials(SecurityCredentials credentials)
                    throws Exception
If security is enabled, it sets given credentials for outgoing calls in the current thread. It has no effect otherwise.

Specified by:
useCredentials in interface GCUBESecurityManager
Parameters:
credentials - the credentials.
Throws:
Exception - if security is enabled, but credentials are corrupt.

useCredentials

public void useCredentials(Thread thread,
                           SecurityCredentials... credentials)
                    throws Exception
If security is enabled, it sets given credentials for outgoing calls in a given thread.

Specified by:
useCredentials in interface GCUBESecurityManager
Parameters:
thread - the thread.
credentials - (optional) the credentials. If omitted, it delegates the credentials used for the current thread to the given thread.
Throws:
Exception - if security is enabled, but credentials are corrupt.

getCredentials

public SecurityCredentials getCredentials()
It returns the credentials for outgoing calls currently set in the current thread.

Specified by:
getCredentials in interface GCUBESecurityManager
Returns:
the credentials.

setSecurity

public void setSecurity(Remote s,
                        GCUBESecurityManager.AuthMode e,
                        GCUBESecurityManager.DelegationMode d)
                 throws Exception
If security is enabled, sets the desired level of encryption and the mode of credential delegation on the stub of a remote porttype. It has no effect otherwise.

Specified by:
setSecurity in interface GCUBESecurityManager
Parameters:
s - the stub.
e - the encryption level.
d - the delegation mode.
Throws:
Exception - if the settings could not be enforced.

setAuthMethod

public void setAuthMethod(GCUBESecurityManager.AuthMethod m)
Description copied from interface: GCUBESecurityManager
Adds an authentication method to be used in this security context

Specified by:
setAuthMethod in interface GCUBESecurityManager
Parameters:
m - the authentication method


Copyright © 2013. All Rights Reserved.