X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Ftrust%2Fauth.py;h=59ca4c27d2719eabe4b1b6243ca7a51363228244;hb=4f9d407d0ce159bdb359e9ab500bf88b5f586e62;hp=0b9f081242d84f7fc4875cb8e787b47fabb49be9;hpb=0eb8d56df7ee56f2ffebeef43c55cc7416fdf278;p=sfa.git diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index 0b9f0812..59ca4c27 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -2,6 +2,7 @@ # SfaAPI authentication # import sys +from types import StringTypes from sfa.util.faults import InsufficientRights, MissingCallerGID, MissingTrustedRoots, PermissionError, \ BadRequestHash, ConnectionKeyGIDMismatch, SfaPermissionDenied, CredentialNotVerifiable, Forbidden, \ @@ -56,9 +57,13 @@ class Auth: speaking_for_xrn=None): if xrns is None: xrns=[] 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] + 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 # if xrns are specified they cannot be None or empty string