### Manage X.509 SVIDs and CA Bundles with X509Source Source: https://pypi.org/project/spiffe Utilize X509Source for automatic management of X.509 SVIDs and CA bundles. This simplifies SVID retrieval and validation. ```python from spiffe import X509Source # Automatically manage X.509 SVIDs and CA bundles with X509Source() as source: x509_svid = source.svid print(f'SPIFFE ID: {x509_svid.spiffe_id}') ``` -------------------------------- ### Fetch X.509 and JWT SVIDs with WorkloadApiClient Source: https://pypi.org/project/spiffe Use WorkloadApiClient to fetch X.509 and JWT SVIDs. Ensure the SPIFFE_ENDPOINT_SOCKET environment variable is set or provided programmatically. ```python from spiffe import WorkloadApiClient # Fetch X.509 and JWT SVIDs with WorkloadApiClient() as client: x509_svid = client.fetch_x509_svid() print(f'SPIFFE ID: {x509_svid.spiffe_id}') jwt_svid = client.fetch_jwt_svid(audience={"test"}) print(f'SPIFFE ID: {jwt_svid.spiffe_id}') ``` -------------------------------- ### Set Timeouts for WorkloadApiClient Calls Source: https://pypi.org/project/spiffe Configure default or per-call timeouts for WorkloadApiClient to prevent indefinite blocking. Per-call timeouts override the default. ```python with WorkloadApiClient(default_timeout=5.0) as client: jwt_svid = client.fetch_jwt_svid(audience={"test"}) jwt_svid = client.fetch_jwt_svid(audience={"test"}, timeout=1.0) ``` -------------------------------- ### Manage and Validate JWT SVIDs with JwtSource Source: https://pypi.org/project/spiffe Employ JwtSource to manage and validate JWT SVIDs and JWKS bundles. This is useful for applications requiring JWT-based authentication. ```python from spiffe import JwtSource # Manage and validate JWT SVIDs and JWKS bundles with JwtSource() as source: jwt_svid = source.fetch_svid(audience={'test'}) print(f'SPIFFE ID: {jwt_svid.spiffe_id}') print(f'Token: {jwt_svid.token}') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.