Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
PluggableAuthService.plugins.ChallengeProtocolChooser.ChallengeProtocolChooser Class Reference
Inheritance diagram for PluggableAuthService.plugins.ChallengeProtocolChooser.ChallengeProtocolChooser:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.ChallengeProtocolChooser.ChallengeProtocolChooser:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def chooseProtocols
def manage_editProtocolMapping
def manage_updateProtocolMapping

Public Attributes

 id
 title

Static Public Attributes

string meta_type = 'Challenge Protocol Chooser Plugin'
tuple security = ClassSecurityInfo()
tuple manage_options
tuple manage_editProtocolMappingForm

Private Member Functions

def _getProtocolsFor
def _listProtocols

Private Attributes

 _id
 _map

Detailed Description

PAS plugin for choosing challenger protocol based on request

Definition at line 82 of file ChallengeProtocolChooser.py.


Constructor & Destructor Documentation

def PluggableAuthService.plugins.ChallengeProtocolChooser.ChallengeProtocolChooser.__init__ (   self,
  id,
  title = None,
  mapping = None 
)

Definition at line 97 of file ChallengeProtocolChooser.py.

00097 
00098     def __init__(self, id, title=None, mapping=None):
00099         self._id = self.id = id
00100         self.title = title
00101         self._map = OOBTree()
00102         if mapping is not None:
00103             self.manage_updateProtocolMapping(mapping=mapping)


Member Function Documentation

Definition at line 116 of file ChallengeProtocolChooser.py.

00116 
00117     def _getProtocolsFor(self, request_type):
00118         label = _request_type_bmap.get(request_type, None)
00119         if label is None:
00120             return
00121         return self._map.get(label, None)
00122 

Here is the caller graph for this function:

Definition at line 123 of file ChallengeProtocolChooser.py.

00123 
00124     def _listProtocols(self):
00125         pas_instance = self._getPAS()
00126         plugins = pas_instance._getOb('plugins')
00127 
00128         challengers = plugins.listPlugins( IChallengePlugin )
00129         found = []
00130 
00131         for challenger_id, challenger in challengers:
00132             protocol = getattr(challenger, 'protocol', challenger_id)
00133             if protocol not in found:
00134                 found.append(protocol)
00135 
00136         return found

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file ChallengeProtocolChooser.py.

00105 
00106     def chooseProtocols(self, request):
00107         pas_instance = self._getPAS()
00108         plugins = pas_instance._getOb('plugins')
00109 
00110         sniffers = plugins.listPlugins( IRequestTypeSniffer )
00111 
00112         for sniffer_id, sniffer in sniffers:
00113             request_type = sniffer.sniffRequestType(request)
00114             if request_type is not None:
00115                 return self._getProtocolsFor(request_type)

Here is the call graph for this function:

Edit Protocol Mapping

Definition at line 141 of file ChallengeProtocolChooser.py.

00141 
00142     def manage_editProtocolMapping(self, REQUEST=None):
00143         """ Edit Protocol Mapping
00144         """
00145         info = []
00146         available_protocols = self._listProtocols()
00147 
00148         request_types = listRequestTypesLabels()
00149         request_types.sort()
00150 
00151         for label in request_types:
00152             settings = []
00153             select_any = False
00154             info.append(
00155                 {'label': label,
00156                  'settings': settings
00157                  })
00158             protocols = self._map.get(label, None)
00159             if not protocols:
00160                 select_any = True
00161             for protocol in available_protocols:
00162                 selected = False
00163                 if protocols and protocol in protocols:
00164                     selected = True
00165                 settings.append({'label': protocol,
00166                                  'selected': selected,
00167                                  'value': protocol,
00168                                  })
00169 
00170             settings.insert(0, {'label': '(any)',
00171                                 'selected': select_any,
00172                                 'value': '',
00173                                 })
00174         return self.manage_editProtocolMappingForm(info=info, REQUEST=REQUEST)

Here is the call graph for this function:

Update mapping of Request Type to Protocols

Definition at line 175 of file ChallengeProtocolChooser.py.

00175 
00176     def manage_updateProtocolMapping(self, mapping, REQUEST=None):
00177         """ Update mapping of Request Type to Protocols
00178         """
00179         for key, value in mapping.items():
00180             value = filter(None, value)
00181             if not value:
00182                 if self._map.has_key(key):
00183                     del self._map[key]
00184             else:
00185                 self._map[key] = value
00186 
00187         if REQUEST is not None:
00188             REQUEST['RESPONSE'].redirect(
00189                 '%s/manage_editProtocolMapping'
00190                 '?manage_tabs_message='
00191                 'Protocol+Mappings+Changed.'
00192                 % self.absolute_url())
00193 
00194 classImplements(ChallengeProtocolChooser,
00195                 IChallengeProtocolChooserPlugin,
00196                 IChallengeProtocolChooser,
00197                )
00198 
00199 InitializeClass(ChallengeProtocolChooser)

Here is the call graph for this function:


Member Data Documentation

Definition at line 98 of file ChallengeProtocolChooser.py.

Definition at line 100 of file ChallengeProtocolChooser.py.

Definition at line 98 of file ChallengeProtocolChooser.py.

Initial value:
PageTemplateFile(
        'www/cpcEdit', globals(),
        __name__='manage_editProtocolMappingForm')

Definition at line 137 of file ChallengeProtocolChooser.py.

Initial value:
(({'label': 'Mapping',
                        'action': 'manage_editProtocolMapping'
                        },
                       )
                      + BasePlugin.manage_options
                      )

Definition at line 90 of file ChallengeProtocolChooser.py.

Definition at line 86 of file ChallengeProtocolChooser.py.

Definition at line 88 of file ChallengeProtocolChooser.py.

Definition at line 99 of file ChallengeProtocolChooser.py.


The documentation for this class was generated from the following file: