ProxyManagerClient

ProxyManagerClient has the function to “talk” to the ProxyManager service (ProxyManagerHandler). This inherits the DIRAC base Client for direct execution of server functionality. Client also contain caching of the requested proxy information.

class DIRAC.FrameworkSystem.Client.ProxyManagerClient.ProxyManagerClient(*args, **kwargs)

Bases: object

__init__()
clearCaches()

Clear caches

deleteGeneratedProxyFile(chain)

Delete a file generated by a dump

Parameters:

chain (X509Chain) – proxy as a chain

Returns:

S_OK()

deleteProxyBundle(idList)

delete a list of id’s

Parameters:

idList (list,tuple) – list of identity numbers

Returns:

S_OK(int)/S_ERROR()

downloadProxy(**kwargs)

Get a proxy Chain from the proxy management

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • limited (boolean) – if need limited proxy

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • cacheTime (int) – store in a cache time in a seconds

  • proxyToConnect (X509Chain) – proxy as a chain

  • token (str) – valid token to get a proxy

Returns:

S_OK(X509Chain)/S_ERROR()

downloadProxyToFile(userDN, userGroup, limited=False, requiredTimeLeft=1200, cacheTime=14400, filePath=None, proxyToConnect=None, token=None)

Get a proxy Chain from the proxy management and write it to file

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • limited (boolean) – if need limited proxy

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • cacheTime (int) – store in a cache time in a seconds

  • filePath (str) – path to save proxy

  • proxyToConnect (X509Chain) – proxy as a chain

  • token (str) – valid token to get a proxy

Returns:

S_OK(X509Chain)/S_ERROR()

downloadVOMSProxy(**kwargs)

Download a proxy if needed and transform it into a VOMS one

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • limited (boolean) – if need limited proxy

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • cacheTime (int) – store in a cache time in a seconds

  • requiredVOMSAttribute (str) – VOMS attr to add to the proxy

  • proxyToConnect (X509Chain) – proxy as a chain

  • token (str) – valid token to get a proxy

Returns:

S_OK(X509Chain)/S_ERROR()

downloadVOMSProxyToFile(userDN, userGroup, limited=False, requiredTimeLeft=1200, cacheTime=14400, requiredVOMSAttribute=None, filePath=None, proxyToConnect=None, token=None)

Download a proxy if needed, transform it into a VOMS one and write it to file

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • limited (boolean) – if need limited proxy

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • cacheTime (int) – store in a cache time in a seconds

  • requiredVOMSAttribute (str) – VOMS attr to add to the proxy

  • filePath (str) – path to save proxy

  • proxyToConnect (X509Chain) – proxy as a chain

  • token (str) – valid token to get a proxy

Returns:

S_OK(X509Chain)/S_ERROR()

dumpProxyToFile(chain, destinationFile=None, requiredTimeLeft=600)

Dump a proxy to a file. It’s cached so multiple calls won’t generate extra files

Parameters:
  • chain (X509Chain) – proxy as a chain

  • destinationFile (str) – path to store proxy

  • requiredTimeLeft (int) – required proxy live time in a seconds

Returns:

S_OK(str)/S_ERROR()

getDBContents(condDict={}, sorting=[['UserDN', 'DESC']], start=0, limit=0)

Get the contents of the db

Parameters:

condDict (dict) – search condition

Returns:

S_OK(dict)/S_ERROR() – dict contain fields, record list, total records

getPayloadProxyFromDIRACGroup(userDN, userGroup, requiredTimeLeft, token=None, proxyToConnect=None)

Download a payload proxy with VOMS extensions depending on the group

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • token (str) – valid token to get a proxy

  • proxyToConnect (X509Chain) – proxy as a chain

Returns:

S_OK(X509Chain)/S_ERROR()

getPayloadProxyFromVOMSGroup(userDN, vomsAttr, token, requiredTimeLeft, proxyToConnect=None)

Download a payload proxy with VOMS extensions depending on the VOMS attr

Parameters:
  • userDN (str) – user DN

  • vomsAttr (str) – VOMS attribute

  • token (str) – valid token to get a proxy

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • proxyToConnect (X509Chain) – proxy as a chain

Returns:

S_OK(X509Chain)/S_ERROR()

getPilotProxyFromDIRACGroup(userDN, userGroup, requiredTimeLeft=43200, proxyToConnect=None)

Download a pilot proxy with VOMS extensions depending on the group

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • requiredTimeLeft (int) – required proxy live time in seconds

  • proxyToConnect (X509Chain) – proxy as a chain

Returns:

S_OK(X509Chain)/S_ERROR()

getPilotProxyFromVOMSGroup(userDN, vomsAttr, requiredTimeLeft=43200, proxyToConnect=None)

Download a pilot proxy with VOMS extensions depending on the group

Parameters:
  • userDN (str) – user DN

  • vomsAttr (str) – VOMS attribute

  • requiredTimeLeft (int) – required proxy live time in a seconds

  • proxyToConnect (X509Chain) – proxy as a chain

Returns:

S_OK(X509Chain)/S_ERROR()

getUploadedProxyLifeTime(DN, group=None)

Get the remaining seconds for an uploaded proxy

Parameters:
  • DN (str) – user DN

  • group (str) – group (obsolete and ignored)

Returns:

S_OK(int)/S_ERROR()

getUserPersistence(**kwargs)

Check if a user(DN-group) has a proxy in the proxy management Updates internal cache if needed to minimize queries to the service

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • validSeconds (int) – proxy valid time in a seconds

Returns:

S_OK()/S_ERROR()

getUserProxiesInfo()

Get the user proxies uploaded info

Returns:

S_OK(dict)/S_ERROR()

getVOMSAttributes(chain)

Get the voms attributes for a chain

Parameters:

chain (X509Chain) – proxy as a chain

Returns:

S_OK(str)/S_ERROR()

instance = <DIRAC.FrameworkSystem.Client.ProxyManagerClient.ProxyManagerClient object>
renewProxy(proxyToBeRenewed=None, minLifeTime=3600, newProxyLifeTime=43200, proxyToConnect=None)

Renew a proxy using the ProxyManager

Parameters:
  • proxyToBeRenewed (X509Chain) – proxy to renew

  • minLifeTime (int) – if proxy life time is less than this, renew. Skip otherwise

  • newProxyLifeTime (int) – life time of new proxy

  • proxyToConnect (X509Chain) – proxy to use for connecting to the service

Returns:

S_OK(X509Chain)/S_ERROR()

requestToken(requesterDN, requesterGroup, numUses=1)

Request a number of tokens. usesList must be a list of integers and each integer is the number of uses a token must have

Parameters:
  • requesterDN (str) – user DN

  • requesterGroup (str) – user group

  • numUses (int) – number of uses

Returns:

S_OK(tuple)/S_ERROR() – tuple contain token, number uses

setPersistency(userDN, userGroup, persistent)

Set the persistency for user/group

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • persistent (boolean) – presistent flag

Returns:

S_OK()/S_ERROR()

uploadProxy(proxy=None, restrictLifeTime: int = 0, rfcIfPossible=None)

Upload a proxy to the proxy management service using delegation

Parameters:
  • proxy (X509Chain) – proxy as a chain

  • restrictLifeTime – proxy live time in a seconds

Returns:

S_OK(dict)/S_ERROR() – dict contain proxies

userHasProxy(**kwargs)

Check if a user(DN-group) has a proxy in the proxy management Updates internal cache if needed to minimize queries to the service

Parameters:
  • userDN (str) – user DN

  • userGroup (str) – user group

  • validSeconds (int) – proxy valid time in a seconds

Returns:

S_OK()/S_ERROR()