Package flumotion :: Package component :: Package bouncers :: Module component :: Class Bouncer
[hide private]

Class Bouncer

source code

             object --+        
                      |        
common.common.InitMixin --+    
                          |    
extern.log.log.Loggable --+    
                          |    
    component.BaseComponent --+
                              |
                             Bouncer
Known Subclasses:

I am the base class for all bouncer components.

Nested Classes [hide private]
child class of BaseComponentMedium componentMediumClass
the medium class to use for this component
Instance Methods [hide private]
 
init(self)
A subclass should do as little as possible in its init method.
source code
 
setDomain(self, name) source code
 
getDomain(self) source code
 
typeAllowed(self, keycard)
Verify if the keycard is an instance of a Keycard class specified in the bouncer's keycardClasses variable.
source code
 
setEnabled(self, enabled) source code
 
getEnabled(self) source code
 
do_stop(self)
BaseComponent vmethod for stopping.
source code
 
authenticate(self, keycard) source code
bool
do_expireKeycards(self, elapsed)
Override to expire keycards managed by sub-classes.
source code
bool
do_validate(self, keycard)
Override to check keycards before authentication steps.
source code
 
do_authenticate(self, keycard)
Must be overridden by subclasses.
source code
 
on_keycardAdded(self, keycard)
Override to update sub-class specific data related to keycards.
source code
 
on_keycardRemoved(self, keycard)
Override to cleanup sub-class specific data related to keycards.
source code
 
on_enabled(self)
Override to initialize sub-class specific data when the bouncer is enabled.
source code
 
on_disabled(self)
Override to cleanup sub-class specific data when the bouncer is disabled.
source code
 
hasKeycard(self, keycard) source code
 
generateKeycardId(self) source code
 
addKeycard(self, keycard)
Adds a keycard to the bouncer.
source code
 
removeKeycard(self, keycard) source code
 
removeKeycardId(self, keycardId) source code
 
keepAlive(self, issuerName, ttl) source code
 
expireAllKeycards(self) source code
 
expireKeycardId(self, keycardId) source code
 
expireKeycardIds(self, keycardIds) source code
 
_expireNextKeycardBlock(self, total, keycardIds, finished) source code
 
_addKeycard(self, keycard)
Adds a keycard without checking.
source code
 
_expire(self) source code

Inherited from component.BaseComponent: __init__, __provides__, addMessage, adminCallRemote, checkPropertyType, check_properties, do_check, do_setup, fixRenamedProperties, getMood, getName, getWorkerName, modifyProperty, observerAppend, observerRemove, removeMessage, setMedium, setMood, setShutdownHook, setWorkerName, setup, setup_completed, stop, waitForHappy, warnDeprecatedProperties

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from extern.log.log.Loggable: __providedBy__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
tuple of flumotion.common.keycards.Keycard class objects keycardClasses = ()
tuple of all classes of keycards this bouncer can authenticate, in order of preference
  logCategory = 'bouncer'
Implementors can provide a category to log their messages under.
  KEYCARD_EXPIRE_INTERVAL = 120

Inherited from component.BaseComponent: __implemented__

Instance Variables [hide private]

Inherited from component.BaseComponent: medium, name, uiState

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

init(self)

source code 

A subclass should do as little as possible in its init method. In particular, it should not try to access resources.

Failures during init are marshalled back to the manager through the worker's remote_create method, since there is no component state proxied to the manager yet at the time of init.

Overrides: component.BaseComponent.init
(inherited documentation)

do_stop(self)

source code 

BaseComponent vmethod for stopping. The component should do any cleanup it needs, but must not set the component's mood to sleeping.

Returns:
twisted.internet.defer.Deferred
Overrides: component.BaseComponent.do_stop
(inherited documentation)

do_expireKeycards(self, elapsed)

source code 

Override to expire keycards managed by sub-classes.

Parameters:
  • elapsed (int) - time in second since the last expiration call.
Returns: bool
if there is more keycard to expire. If False is returned, the expirer poller MAY be stopped.

do_validate(self, keycard)

source code 

Override to check keycards before authentication steps. Should return True if the keycard is valid, False otherwise. #FIXME: This belong to the base bouncer class

Parameters:
  • keycard (flumotion.common.keycards.Keycard) - the keycard that should be validated before authentication
Returns: bool
True if the keycard is accepted, False otherwise

do_authenticate(self, keycard)

source code 

Must be overridden by subclasses.

Authenticate the given keycard. Return the keycard with state AUTHENTICATED to authenticate, with state REQUESTING to continue the authentication process, or REFUSED to deny the keycard or a deferred which should have the same eventual value.

FIXME: Currently, a return value of 'None' is treated as rejecting the keycard. This is unintuitive.

FIXME: in fact, for authentication sessions like challenge/response, returning a keycard with state REFUSED instead of None will not work properly and may enter in an asynchronous infinit loop.

on_keycardAdded(self, keycard)

source code 

Override to update sub-class specific data related to keycards. Called when the base bouncer accepts and references a new keycard.

on_keycardRemoved(self, keycard)

source code 

Override to cleanup sub-class specific data related to keycards. Called when the base bouncer has cleanup his references to a keycard.

addKeycard(self, keycard)

source code 

Adds a keycard to the bouncer. Can be called with the same keycard more than one time. If the keycard has already been added successfully, adding it again will succeed and return True.

Parameters:
  • keycard - the keycard to add.
Returns:
if the bouncer accepts the keycard.

_addKeycard(self, keycard)

source code 

Adds a keycard without checking. Used by sub-class knowing what they do.