diff --git a/fabrictestbed/__init__.py b/fabrictestbed/__init__.py index 0e55b07..79639ee 100644 --- a/fabrictestbed/__init__.py +++ b/fabrictestbed/__init__.py @@ -1,2 +1,2 @@ -__version__ = "1.7.8" +__version__ = "1.7.9" __VERSION__ = __version__ diff --git a/fabrictestbed/token_manager/token_manager.py b/fabrictestbed/token_manager/token_manager.py index d0b49e7..d5dc58f 100644 --- a/fabrictestbed/token_manager/token_manager.py +++ b/fabrictestbed/token_manager/token_manager.py @@ -339,3 +339,17 @@ def get_user_email(self) -> str: if not self.user_email and self.get_id_token() and self.cm_proxy: self._extract_project_and_user_info_from_token(cm_host=self.cm_proxy.host) return self.user_email + + def get_project_name(self) -> str: + """ + Retrieve the project name associated with the current session. + + This method returns the project name if it has already been determined. If the project name + has not been set and an identity token is available, it will attempt to extract + the project name by decoding the token using the credential manager proxy. + + @return: The project_name if available; otherwise, None. + """ + if not self.project_name and self.get_id_token() and self.cm_proxy: + self._extract_project_and_user_info_from_token(cm_host=self.cm_proxy.host) + return self.project_name