Skip to content

Commit

Permalink
Fix for tkt854 issues when verifying speaksfor credentials with _ in …
Browse files Browse the repository at this point in the history
…xml:id, and use accessors.
  • Loading branch information
dmargery committed Jan 28, 2016
1 parent fdc28f9 commit 7b11867
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/gcf/geni/util/speaksfor_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ def verify_speaks_for(cred, tool_gid, speaking_for_urn, \
if cred.get_cred_type() != ABACCredential.ABAC_CREDENTIAL_TYPE:
return False, None, "Credential not of type ABAC but %s" % cred.get_cred_type

if cred.signature is None or cred.signature.gid is None:
if cred.get_signature() is None or cred.signature.gid is None:
return False, None, "Credential malformed: missing signature or signer cert. Cred: %s" % cred.get_summary_tostring()
user_gid = cred.signature.gid
user_gid = cred.get_signature().get_issuer_gid()
user_urn = user_gid.get_urn()

# URN of signer from cert must match URN of 'speaking-for' argument
Expand Down
2 changes: 1 addition & 1 deletion src/gcf/sfa/trust/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def decode(self):
logger.log_exc ("Failed to parse credential, %s"%self.xml)
raise
sig = doc.getElementsByTagName("Signature")[0]
ref_id = sig.getAttribute("xml:id").strip().strip("Sig_")
ref_id = sig.getAttribute("xml:id").strip().replace("Sig_","",1)
# The xml:id tag is optional, and could be in a
# Reference xml:id or Reference UID sub element instead
if not ref_id or ref_id == '':
Expand Down

0 comments on commit 7b11867

Please sign in to comment.