Skip to content

Commit

Permalink
feat (ProxyDB): propagate proxy strength upon download
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed May 10, 2022
1 parent 381a593 commit 5f07bf4
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/DIRAC/FrameworkSystem/DB/ProxyDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,20 @@ def getProxyStrength(self, userDN, userGroup=None, vomsAttr=None):
:param vomsAttr: VOMS attr we plan to add on the proxy
"""
# Look in the cache
retVal = self.__getPemAndTimeLeft(userDN, userGroup, vomsAttr=vomsAttr)
retVal = Registry.getProxyProvidersForDN(userDN)

if retVal["OK"]:
pemData = retVal["Value"][0]
chain = X509Chain()
retVal = chain.loadProxyFromString(pemData)
if retVal["OK"]:
return chain.getStrength()
providers = retVal["Value"]
providers.append("Certificate")
for proxyProvider in providers:

retVal = self.__getPemAndTimeLeft(userDN, userGroup, vomsAttr=vomsAttr, proxyProvider=proxyProvider)
if retVal["OK"]:
pemData = retVal["Value"][0]
chain = X509Chain()
retVal = chain.loadProxyFromString(pemData)
if retVal["OK"]:
return chain.getStrength()

return retVal

Expand Down Expand Up @@ -589,7 +596,11 @@ def __getPemAndTimeLeft(self, userDN, userGroup=None, vomsAttr=None, proxyProvid
result = chain.loadProxyFromString(record[0])
if not result["OK"]:
return result
result = chain.generateProxyToString(record[1], diracGroup=userGroup, rfc=True)
result = chain.getStrength()
if not result["OK"]:
return result
strength = result["Value"]
result = chain.generateProxyToString(record[1], diracGroup=userGroup, strength=strength, rfc=True)
if not result["OK"]:
return result
return S_OK((result["Value"], record[1]))
Expand Down

0 comments on commit 5f07bf4

Please sign in to comment.