本文整理匯總了Python中sfa.trust.credential.Credential.dump_string方法的典型用法代碼示例。如果您正苦於以下問題:Python Credential.dump_string方法的具體用法?Python Credential.dump_string怎麽用?Python Credential.dump_string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfa.trust.credential.Credential
的用法示例。
在下文中一共展示了Credential.dump_string方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: log_invalid_cred
# 需要導入模塊: from sfa.trust.credential import Credential [as 別名]
# 或者: from sfa.trust.credential.Credential import dump_string [as 別名]
def log_invalid_cred(cred):
if not isinstance (cred, StringTypes):
logger.info("cannot validate credential %s - expecting a string"%cred)
error="checkCredentials: expected a string, received %s"%(type(cred))
else:
cred_obj=Credential(string=cred)
logger.info("failed to validate credential - dump=%s"%\
cred_obj.dump_string(dump_parents=True))
error = sys.exc_info()[:2]
return error
示例2: checkCredentials
# 需要導入模塊: from sfa.trust.credential import Credential [as 別名]
# 或者: from sfa.trust.credential.Credential import dump_string [as 別名]
def checkCredentials(self, creds, operation, hrn = None):
valid = []
if not isinstance(creds, list):
creds = [creds]
logger.debug("Auth.checkCredentials with %d creds"%len(creds))
for cred in creds:
try:
self.check(cred, operation, hrn)
valid.append(cred)
except:
cred_obj=Credential(string=cred)
logger.debug("failed to validate credential - dump=%s"%cred_obj.dump_string(dump_parents=True))
error = sys.exc_info()[:2]
continue
if not len(valid):
raise InsufficientRights('Access denied: %s -- %s' % (error[0],error[1]))
return valid
示例3: log_invalid_cred
# 需要導入模塊: from sfa.trust.credential import Credential [as 別名]
# 或者: from sfa.trust.credential.Credential import dump_string [as 別名]
def log_invalid_cred(cred):
cred_obj=Credential(string=cred)
logger.debug("failed to validate credential - dump=%s"%cred_obj.dump_string(dump_parents=True))
error = sys.exc_info()[:2]
return error