summaryrefslogtreecommitdiff
path: root/plugins/httpapi
diff options
context:
space:
mode:
authoromnom62 <omnom62@outlook.com>2026-10-03 16:44:59 +1000
committeromnom62 <omnom62@outlook.com>2026-10-03 16:44:59 +1000
commite562acc5a2ac5efc16e1a9d623ca962225ee31f7 (patch)
treea8d2366e0833cf4d8824ffe1ccaf2e35da033e2a /plugins/httpapi
parent6e9fe2c879895ade7c66b4ee199b0bac36f2b2e6 (diff)
downloadrest.vyos-t8989_auth_methods_rework.tar.gz
rest.vyos-t8989_auth_methods_rework.zip
https: T8989: auth_methods AI comments fixedt8989_auth_methods_rework
Diffstat (limited to 'plugins/httpapi')
-rw-r--r--plugins/httpapi/vyos.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/httpapi/vyos.py b/plugins/httpapi/vyos.py
index 30088f3..e8121e7 100644
--- a/plugins/httpapi/vyos.py
+++ b/plugins/httpapi/vyos.py
@@ -25,6 +25,7 @@ options:
type: str
vars:
- name: ansible_httpapi_api_key
+ - name: ansible_vyos_api_key
env:
- name: ANSIBLE_HTTPAPI_API_KEY
- name: VYOS_API_KEY
@@ -65,6 +66,18 @@ options:
ini:
- section: httpapi
key: oidc_client_secret
+ oidc_timeout:
+ description: >-
+ Timeout, in seconds, for the token request made to the OIDC
+ provider. An unavailable or stalled identity provider would
+ otherwise hang the Ansible task indefinitely.
+ type: int
+ default: 10
+ vars:
+ - name: ansible_httpapi_oidc_timeout
+ ini:
+ - section: httpapi
+ key: oidc_timeout
"""
import json
@@ -180,12 +193,16 @@ class HttpApi(HttpApiBase):
"client_secret": self.get_option("oidc_client_secret"),
},
)
+ timeout = self.get_option("oidc_timeout")
+ if timeout is None:
+ timeout = 10
try:
response = open_url(
token_url,
data=body,
headers={"Content-Type": "application/x-www-form-urlencoded"},
method="POST",
+ timeout=timeout,
)
payload = json.loads(response.read())
except Exception as exc: