oidc_token_setOIDC

Mock Jutsu HOW-TO | EN

The oidc_token_set function is a cornerstone of the mock-jutsu library, designed to provide developers with high-fidelity, cryptographically sound test data for OpenID Connect (OIDC) workflows. In modern application development, simulating identity providers can be a cumbersome process involving complex infrastructure or brittle static strings. This function eliminates those hurdles by generating a complete authentication set that includes an ES256-signed JSON Web Token (JWT) using the P-256 elliptic curve algorithm. By producing a production-grade signature, it allows your security middleware to perform genuine validation routines, ensuring that your authentication logic is tested against realistic cryptographic standards rather than simplified placeholders.

What makes oidc_token_set particularly effective for generating mock data is its comprehensive output. Each call returns a signed token, a verifiable JSON Web Key Set (JWKS), and a specific Key ID (kid) that correctly links the token to its corresponding public key. The generated JWT is populated with a full suite of standard OIDC claims, including issuer (iss), subject (sub), audience (aud), expiration (exp), issued at (iat), JWT ID (jti), and email. This level of detail is essential for testing claim-based access control and token introspection features, as it provides all the necessary metadata required by modern authorization frameworks to verify a user's identity and permissions.

Integrating this function into your testing pipeline is remarkably flexible across different environments. Python developers can quickly generate a payload using jutsu.generate('oidc_token_set'), while DevOps engineers can leverage the mock-jutsu command-line interface for rapid prototyping. For those focused on performance and load testing, the library includes a dedicated JMeter function, allowing testers to inject unique, validly signed tokens into high-concurrency scenarios with a simple variable reference. This multi-tool accessibility ensures that whether you are writing unit tests, building integration suites, or performing stress tests, your test data remains consistent and reliable.

The primary advantage of using mock-jutsu for OIDC simulation is the significant reduction in development friction. Instead of bypassing security checks during local development, teams can maintain a "secure by default" posture by using mathematically valid tokens that mirror production behavior. This leads to more robust codebases and fewer surprises during deployment. By utilizing the oidc_token_set function, engineering teams can accelerate their delivery cycles, improve security coverage, and ensure that their identity logic is fully verified long before it reaches a live environment.

CLI Usage
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 --mask
Python API
from 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)
JMeter
${__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)}
REST API
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

Parameters

Parameter Values Description
--mask true | false Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…)

Other Languages