Changeset 10475 for main/waeup.cas/trunk/waeup/cas/authenticators.py
- Timestamp:
- 8 Aug 2013, 10:09:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/authenticators.py
r10474 r10475 1 1 """Components that do the real authentication stuff. 2 2 """ 3 import re 3 4 from pkg_resources import iter_entry_points 4 5 … … 117 118 name = 'kofa1' 118 119 119 def __init__(self, auth_backends=None): 120 self.backends = auth_backends 120 def __init__(self, auth_backends="{}"): 121 try: 122 self.backends = eval(auth_backends) 123 except: 124 raise ValueError('auth_backends must be a ' 125 'valid Python expression.') 126 self._check_options() 127 128 def _check_options(self): 129 if not isinstance(self.backends, dict): 130 raise ValueError('Backends must be configured as dicts.') 131 for key, val in self.backends.items(): 132 if not isinstance(val, dict): 133 raise ValueError( 134 'Backend %s: config must be a dict' % key) 135 if not 'url' in val: 136 raise ValueError( 137 'Backend %s: config must contain an `url` key.' % key) 138 if not 'marker' in val: 139 self.backends[key]['marker'] = '.+' 140 try: 141 re.compile(self.backends[key]['marker']) 142 except: 143 raise ValueError( 144 'Backend %s: marker must be a valid regular expr.:' % ( 145 key,)) 121 146 122 147 def check_credentials(self, username='', password=''):
Note: See TracChangeset for help on using the changeset viewer.