From c3e2a8a86d88ba7d8ebab46ef85ca530fbf709ff Mon Sep 17 00:00:00 2001 From: Andreas Olsson Date: Sat, 20 Apr 2024 13:29:56 +0200 Subject: [PATCH] Check for failure to determine default JWT audience --- vault_oidc_ssh_cert_action.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vault_oidc_ssh_cert_action.py b/vault_oidc_ssh_cert_action.py index 510c9ab..6070396 100644 --- a/vault_oidc_ssh_cert_action.py +++ b/vault_oidc_ssh_cert_action.py @@ -55,7 +55,13 @@ def _determine_audience(input_audience: str, vault_server: str) -> str: return input_audience vault_fqdn = urllib.parse.urlparse(vault_server).netloc.split(":")[0] - return vault_fqdn + if vault_fqdn: + return vault_fqdn + + title = "Default JWT audience error" + message = "Failed to extract a default JWT audience from the vault_server input." + _set_error_message(title, message) + raise VoscaError(title) def _issue_github_jwt(jwt_aud: str) -> str: