Class OidcUserinfoCallback

java.lang.Object
org.mockserver.oidc.OidcUserinfoCallback
All Implemented Interfaces:
ExpectationCallback<HttpResponse>, ExpectationResponseCallback

public class OidcUserinfoCallback extends Object implements ExpectationResponseCallback
Mock OIDC userinfo endpoint (OIDC Core §5.3).

Userinfo is an OAuth2 protected resource: it MUST be called with a bearer access token and MUST return 401 when that token is missing or invalid (OIDC Core §5.3.1, RFC 6750 §3.1).

Behaviour change. This endpoint was previously a static response that returned sub and every configured additional claim to any caller, with no inspection of the Authorization header at all. That made two common tests impossible to fail: "my application handles a 401 from userinfo when the access token has expired" could never see a 401, and "my application only calls userinfo with a valid token" passed unconditionally. It is the same fabricated-success defect as the introspection endpoint, one endpoint over, and it survived for the same reason the hardcoded issuer did: no test ever exercised the failure path.

Token resolution is delegated to OidcTokenResolver so this endpoint and /introspect cannot drift into disagreeing about the same token.

  • Constructor Details

    • OidcUserinfoCallback

      public OidcUserinfoCallback()
  • Method Details