(
self,
gateway_dir: pathlib.Path,
cluster_name: str,
*,
write_back: bool = True,
insecure: bool = False,
)
| 975 | """ |
| 976 | |
| 977 | def __init__( |
| 978 | self, |
| 979 | gateway_dir: pathlib.Path, |
| 980 | cluster_name: str, |
| 981 | *, |
| 982 | write_back: bool = True, |
| 983 | insecure: bool = False, |
| 984 | ) -> None: |
| 985 | self._gateway_dir = gateway_dir |
| 986 | self._cluster_name = cluster_name |
| 987 | self._write_back = write_back |
| 988 | self._lock = threading.Lock() |
| 989 | self._bundle: dict | None = None |
| 990 | self._token_endpoint: str | None = None |
| 991 | # Single httpx.Client serves both discovery (unauthenticated |
| 992 | # GET) and refresh (POST with form-encoded body) — they share |
| 993 | # the same security posture. |
| 994 | # |
| 995 | # - follow_redirects=False: a 3xx during discovery would |
| 996 | # otherwise steer us to an attacker-controlled token |
| 997 | # endpoint. Matches `reqwest::redirect::Policy::none()` in |
| 998 | # the Rust CLI's `oidc_auth.rs::http_client`. |
| 999 | # - verify=not insecure: opt-in TLS-verification disable for |
| 1000 | # self-signed issuers. Matches the Rust CLI's `--insecure` |
| 1001 | # flag plumbing. |
| 1002 | # |
| 1003 | # We don't use authlib's `OAuth2Client` here because it |
| 1004 | # auto-injects an Authorization header on every request from |
| 1005 | # its stored token, which would break the unauthenticated |
| 1006 | # discovery GET. The refresh_token grant for a public client |
| 1007 | # is a single form-encoded POST — small enough to spell out |
| 1008 | # directly with httpx, and easier to test. |
| 1009 | self._http = httpx.Client( |
| 1010 | follow_redirects=False, |
| 1011 | verify=not insecure, |
| 1012 | timeout=15.0, |
| 1013 | ) |
| 1014 | |
| 1015 | def close(self) -> None: |
| 1016 | self._http.close() |
nothing calls this directly
no outgoing calls
no test coverage detected