The oidc_token_set function is a core component of the mock-jutsu library, specifically designed to streamline the creation of high-fidelity identity payloads. When developers need realistic mock data for OpenID Connect (OIDC) integration testing, this function provides a complete, self-consistent set of cryptographic materials. It eliminates the friction of manually generating tokens or relying on external identity providers during the early stages of development, ensuring that your test data remains both secure and functionally accurate for local environments.
At its technical core, oidc_token_set utilises the ES256 (ECDSA using P-256 and SHA-256) algorithm to produce signed JSON Web Tokens (JWT). The function generates a transient key pair and returns a comprehensive object containing the signed token, a corresponding JSON Web Key Set (JWKS), the unique Key ID (kid), and the raw claims. By ensuring the kid in the JWT header is perfectly synchronised with the JWKS, mock-jutsu allows local verification logic to succeed just as it would in a production environment. The generated claims follow strict OIDC standards, including essential fields such as iss, sub, aud, exp, iat, jti, and a mock email address.
This function is indispensable for testing microservices that perform local token validation. Because the output includes a verifiable JWKS, developers can point their application’s JWKS endpoint to a mock response generated by mock-jutsu, facilitating full-stack authentication tests without an internet connection. Whether you are validating token expiry logic, checking audience restrictions, or ensuring that your backend correctly parses identity claims, oidc_token_set provides the necessary infrastructure. It is particularly effective for load testing scenarios where hitting a real OIDC provider would be cost-prohibitive or subject to rate limiting.
Integrating oidc_token_set into your existing workflow is seamless across various environments. Python developers can invoke it directly via the jutsu.generate method, while DevOps engineers might prefer the CLI for quick scripting or pipeline automation. Furthermore, the library’s native JMeter support allows performance testers to inject dynamic, valid tokens into high-concurrency scripts using a simple function call. This versatility ensures that regardless of your stack, generating high-quality mock data for identity flows remains efficient and standardised.
mockjutsu generate oidc_token_setmockjutsu bulk oidc_token_set --count 10mockjutsu export oidc_token_set --count 10 --format jsonmockjutsu export oidc_token_set --count 10 --format csvmockjutsu export oidc_token_set --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate oidc_token_set --maskmockjutsu bulk oidc_token_set --count 5 --maskfrom mockjutsu import jutsujutsu.generate('oidc_token_set')jutsu.bulk('oidc_token_set', count=10)jutsu.template(['oidc_token_set'], count=5)# mask=True: regulation-compliant outputjutsu.generate('oidc_token_set', mask=True)jutsu.bulk('oidc_token_set', count=5, mask=True)${__mockjutsu_oidc(oidc_token_set)}# JMeter Function: __mockjutsu_oidc# Parameter 1: oidc_token_set# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_oidc(oidc_token_set,mask)}GET /generate/oidc_token_set# → {"type":"oidc_token_set","result":"...","status":"ok"}GET /bulk/oidc_token_set?count=10POST /template {"types":["oidc_token_set"],"count":1}# mask=true: regulation-compliant outputGET /generate/oidc_token_set?mask=trueGET /bulk/oidc_token_set?count=5&mask=true| Parameter | Values | Description |
|---|---|---|
| --mask | true | false | Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…) |