TokenManagementUtilities

TokenManagementUtilties contains simple functions used by both TokenManagerClient and TokenManagerHandler.

DIRAC.FrameworkSystem.Utilities.TokenManagementUtilities.getCachedKey(idProviderClient, username: str = None, userGroup: str = None, scope: list[str] = None, audience: str = None)

Build the key to potentially retrieve a cached token given the provided parameters.

Parameters:
  • cachedTokens – dictionary of cached tokens

  • idProviderClient – name of an identity provider in the DIRAC CS

  • username – user name

  • userGroup – group name

  • scope – scope

  • audience – audience

DIRAC.FrameworkSystem.Utilities.TokenManagementUtilities.getCachedToken(cachedTokens: DictCache, cachedKey: str, requiredTimeLeft: int = 0)

Check whether a token related to the information provided is present in cache.

Parameters:
  • cachedTokens – dictionary of cached tokens

  • cachedKey – use to retrieve a potential valid token from cachedTokens

  • requiredTimeLeft – required time

DIRAC.FrameworkSystem.Utilities.TokenManagementUtilities.getIdProviderClient(userGroup: str, idProviderClientName: str = None)

Get an IdProvider client

Parameters:
  • userGroup – group name

  • idProviderClientName – name of an identity provider in the DIRAC CS