From 5549589f1059734227465220f0d95c96155c1a77 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 14 Apr 2015 13:00:07 +0200 Subject: [PATCH] disambiguate get_subject and pretty_subject --- sfa/trust/auth.py | 2 +- sfa/trust/certificate.py | 6 +++--- sfa/trust/credential.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index 2c5a4470..e852e198 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -145,7 +145,7 @@ class Auth: # make sure the client_gid is not blank if not self.client_gid: - raise MissingCallerGID(self.client_cred.get_subject()) + raise MissingCallerGID(self.client_cred.pretty_subject()) # validate the client cert if it exists if self.peer_cert: diff --git a/sfa/trust/certificate.py b/sfa/trust/certificate.py index dc2672f2..c3f37905 100644 --- a/sfa/trust/certificate.py +++ b/sfa/trust/certificate.py @@ -505,13 +505,13 @@ class Certificate: return " "+chunk def pretty_cert(self): + message = "[Cert." x = self.x509.get_subject() ou = getattr(x, "OU") - cn = getattr(x, "CN") - data = self.get_data(field='subjectAltName') - message = "[Cert." if ou: message += " OU: {}".format(ou) + cn = getattr(x, "CN") if cn: message += " CN: {}".format(cn) + data = self.get_data(field='subjectAltName') if data: message += " SubjectAltName:" counter = 0 diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py index 20b1dfde..1f924e02 100644 --- a/sfa/trust/credential.py +++ b/sfa/trust/credential.py @@ -284,7 +284,7 @@ class Credential(object): self.xmlsec_path = path + '/' + 'xmlsec1' break - def get_subject(self): + def pretty_subject(self): subject = "" if not self.gidObject: self.decode() @@ -1078,7 +1078,7 @@ class Credential(object): # show_xml is ignored def dump_string(self, dump_parents=False, show_xml=None): result="" - result += "CREDENTIAL %s\n" % self.get_subject() + result += "CREDENTIAL %s\n" % self.pretty_subject() filename=self.get_filename() if filename: result += "Filename %s\n"%filename privileges = self.get_privileges() -- 2.43.0