0001-adapters-ease-custom-lookup-through-inheritance-4083.patch
mellon/adapters.py | ||
---|---|---|
314 | 314 |
except User.DoesNotExist: |
315 | 315 |
pass |
316 | 316 | |
317 |
user = None |
|
318 |
lookup_by_attributes = utils.get_setting(idp, 'LOOKUP_BY_ATTRIBUTES') |
|
319 |
if lookup_by_attributes: |
|
320 |
user = self._lookup_by_attributes(idp, saml_attributes, lookup_by_attributes) |
|
317 |
user = self.lookup_by_attributes(idp, saml_attributes) |
|
321 | 318 | |
322 | 319 |
created = False |
323 | 320 |
if not user: |
... | ... | |
343 | 340 |
logger.info('created new user %s with name_id %s from issuer %s', nameid_user, name_id, issuer) |
344 | 341 |
return nameid_user |
345 | 342 | |
343 |
def lookup_by_attributes(self, idp, saml_attributes): |
|
344 |
rules = utils.get_setting(idp, 'LOOKUP_BY_ATTRIBUTES') |
|
345 |
if rules: |
|
346 |
return self._lookup_by_attributes(idp, saml_attributes, rules) |
|
347 |
return None |
|
348 | ||
346 | 349 |
def _lookup_by_attributes(self, idp, saml_attributes, lookup_by_attributes): |
347 | 350 |
if not isinstance(lookup_by_attributes, list): |
348 | 351 |
logger.error('invalid LOOKUP_BY_ATTRIBUTES configuration %r: it must be a list', lookup_by_attributes) |
349 |
- |