Ignore:
Timestamp:
22 Aug 2010, 11:33:04 (14 years ago)
Author:
uli
Message:

Make authentication finally work correctly after intensive logical
examination of all possible parameter combinations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/jambtables/authentication.py

    r5452 r5460  
    248248        if not isinstance(credentials, dict):
    249249            return None
    250         if not 'accesscode' in credentials.keys():
    251             return None
    252         if not 'jambregno' in credentials.keys():
    253             credentials['jambregno'] = None
    254         ac = get_access_code(credentials['accesscode'])
     250        accesscode = credentials.get('accesscode', None)
     251        jambregno = credentials.get('jambregno', None)
     252        if accesscode is None:
     253            return None
     254        applicant_data, ac = get_applicant_data(jambregno, accesscode)
     255        appl_ac = getattr(applicant_data, 'access_code', None)
     256        #print "AUTH", accesscode, jambregno
    255257        if ac is None:
    256             # Invalid access code entered.
    257             # XXX: log this.
    258             return None
    259         if credentials['jambregno'] is not None:
    260             # applications of JAMB applicants must exist already
    261             if not application_exists(credentials['jambregno']):
    262                 return None
    263         return ApplicantPrincipalInfo(
    264             credentials['accesscode'], credentials['jambregno']
    265             )
     258            return None
     259        if jambregno is not None and applicant_data is None:
     260            return None
     261        if ac.invalidation_date is not None and appl_ac != ac.representation:
     262            return None
     263        if appl_ac is not None and appl_ac != ac.representation:
     264            return None
     265        return ApplicantPrincipalInfo(accesscode, jambregno)
    266266
    267267    def principalInfo(self, id):
Note: See TracChangeset for help on using the changeset viewer.