Changeset 4500
- Timestamp:
- 27/11/08 10:13:08 (12 years ago)
- Location:
- TI12-security/trunk/python
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/python/ndg.security.common/ndg/security/common/AttCert.py
r4404 r4500 902 902 dtDeltaLifeTime = timedelta(seconds=self.__lifetime) 903 903 except Exception, e: 904 raise AttCertError , "Invalid Certificate lifetime set %.3f" %\905 self.__lifetime 904 raise AttCertError("Invalid Certificate lifetime set %.3f" % 905 self.__lifetime) 906 906 907 907 # Add certificate lifetime to calculate not after time … … 1013 1013 1014 1014 1015 #_________________________________________________________________________1016 1015 def isValidVersion(self): 1017 1016 """Check Attribute Certificate XML file version … … 1024 1023 1025 1024 1026 #_________________________________________________________________________1027 1025 def isValid(self, 1028 1026 raiseExcep=False, … … 1071 1069 if chkVersion and not self.isValidVersion(): 1072 1070 if raiseExcep: 1073 raise AttCertError , 'Attribute Certificate version is ' + \1074 self.__dat['version'] + ' but version ' + \1075 AttCert.version + ' expected'1071 raise AttCertError('Attribute Certificate version is %s ' 1072 'but version %s expected' % 1073 (self.__dat['version'], AttCert.version)) 1076 1074 return False 1077 1075 1078 1076 if chkProvenance and not self.isValidProvenance(): 1079 1077 if raiseExcep: 1080 raise AttCertError , \1081 "Attribute Certificate Provenance must be set to \"" + \1082 "\" or \"".join(AttCert.__validProvenanceSettings) + "\"" 1078 raise AttCertError( 1079 "Attribute Certificate Provenance must be set to \"" 1080 "\" or \"".join(AttCert.__validProvenanceSettings) + "\"") 1083 1081 return False 1084 1082 1085 # Handle exception from XMLSecDoc c.isValidSig() regardless of1083 # Handle exception from XMLSecDoc.isValidSig() regardless of 1086 1084 # raiseExcep flag setting 1087 1085 if chkSig: … … 1091 1089 except InvalidSignature, e: 1092 1090 if raiseExcep: 1093 raise AttCertError , e1091 raise AttCertError(e) 1094 1092 else: 1095 1093 return False … … 1098 1096 return True 1099 1097 1100 1101 #_____________________________________________________________________________1102 1098 # Alternative AttCert constructors 1103 1099 def AttCertRead(filePath): … … 1109 1105 return attCert 1110 1106 1111 #_________________________________________________________________________1112 1107 def AttCertParse(attCertTxt): 1113 1108 """Create a new attribute certificate from string of file content""" -
TI12-security/trunk/python/ndg.security.server/ndg/security/server/authnservice/basicauthn.py
r4404 r4500 1 1 """ 2 Basic Authentication interface - extending the SessionManager AbstractAuthNService3 interface - to allow use with SessionManager2 Basic Authentication interface - extending the SessionManager 3 AbstractAuthNService interface - to allow use with SessionManager 4 4 5 5 NERC Data Grid Project … … 19 19 from ndg.security.server.sessionmanager import SessionManager, \ 20 20 AbstractAuthNService, AuthNServiceInvalidCredentials, AuthNServiceError 21 from ndg.security.common.myproxy import MyProxyClient22 21 23 22 class BasicAuthN(AbstractAuthNService): … … 28 27 '''Instantiate object taking in settings from the input 29 28 properties''' 30 accounts = prop.get('basicAuthN_accounts', []).split() 31 self.accounts = dict([tuple(account.split(':')) \ 32 for account in accounts]) 29 accounts = prop.get('accounts', []).split() 30 self.accounts=dict([tuple(account.split(':')) for account in accounts]) 33 31 34 32 def logon(self, username, passphrase): … … 42 40 ''' 43 41 try: 44 md5Passwd = hashlib. sha224(passphrase).hexdigest()42 md5Passwd = hashlib.md5(passphrase).hexdigest() 45 43 except Exception, e: 46 44 raise AuthNServiceError("%s exception raised making a digest of " -
TI12-security/trunk/python/ndg.security.server/ndg/security/server/sessionmanager.py
r4405 r4500 328 328 '''Load Authentication Service Interface from property settings''' 329 329 authNProp = self.__prop[SessionManager.AUTHN_KEYNAME] 330 authNModFilePath = authNProp. get('moduleFilePath')331 332 self.__authNService = instantiateClass(authNProp. get('moduleName'),333 authNProp. get('className'),330 authNModFilePath = authNProp.pop('moduleFilePath', None) 331 332 self.__authNService = instantiateClass(authNProp.pop('moduleName'), 333 authNProp.pop('className'), 334 334 moduleFilePath=authNModFilePath, 335 335 objectType=AbstractAuthNService, -
TI12-security/trunk/python/ndg.security.test/ndg/security/test/sessionmanager/sessionMgr.cfg
r4402 r4500 121 121 # Specific settings for BasicAuthN Session Manager authentication plugin 122 122 # This sets up two test accounts. Passwords are MD5 encrypted 123 authNService. basicAuthN.accounts: testuser:776767df1f96e3b773eceffad55c61eae53ea31fef3563732046a7a6 ndg-user:d63dc919e201d7bc4c825630d2cf25fdc93d4b2f0d46706d29038d01123 authNService.accounts: testuser:e16b2ab8d12314bf4efbd6203906ea6c ndg-user:e16b2ab8d12314bf4efbd6203906ea6c 124 124 125 ## Example settings for Database based authentication - requires access to a 126 # database; uses SQLAlchemy for Python database bindings 127 #authNService.moduleName: ndg.security.server.authnservice.dbauthn 128 #authNService.className: DatabaseAuthN 129 #authNService.connectionString: postgres://testuser:testpassword@localhost/testUserDb 130 ## This query must return zero rows for invalid credentials entered 131 #authNService.sqlQuery: select username from users where username = '%%(username)s' and md5_passwd = '%%(password)s' 132 #authNService.isMD5EncodedPwd: True 125 133
Note: See TracChangeset
for help on using the changeset viewer.