Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

test(cypress): OIDC Route Test Coverage (#12224)

HS-QUALIBOT6b8222e0fe17
diff --git a/cypress-tests/cypress/e2e/spec/Misc/00003-OidcRouteMismatch.cy.js b/cypress-tests/cypress/e2e/spec/Misc/00003-OidcRouteMismatch.cy.js
new file mode 100644
index 0000000000..1e8ac2c46d
--- /dev/null
+++ b/cypress-tests/cypress/e2e/spec/Misc/00003-OidcRouteMismatch.cy.js
@@ -0,0 +1,37 @@
+import State from "../../../utils/State";
+
+let globalState;
+
+describe("OIDC Endpoint Coverage - SAIAAAAAA-181", () => {
+ before("seed global state", () => {
+ cy.task("getGlobalState").then((state) => {
+ globalState = new State(state);
+ });
+ });
+
+ after("flush global state", () => {
+ cy.task("setGlobalState", globalState.data);
+ });
+
+ context("OIDC Discovery Document", () => {
+ it("should return valid discovery document", () => {
+ cy.oidcDiscoveryCallTest(globalState);
+ });
+ });
+
+ context("OIDC Authorize Route", () => {
+ it("should respond at /oidc/authorize", () => {
+ cy.oidcAuthorizeRouteCheck(globalState);
+ });
+ });
+
+ context("OIDC Supporting Endpoints", () => {
+ it.skip("should return 200 with keys array from JWKS endpoint (skipped: server returns 500 OI_05 — malformed OIDC signing key config, known defect)", () => {
+ cy.oidcJwksCallTest(globalState);
+ });
+
+ it("should have token endpoint at /oauth2/token", () => {
+ cy.oidcTokenEndpointProbeCallTest(globalState);
+ });
+ });
+});
diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.js
index ede8288b4b..042743c1f8 100644
--- a/cypress-tests/cypress/support/commands.js
+++ b/cypress-tests/cypress/support/commands.js
@@ -8260,6 +8260,130 @@ Cypress.Commands.add("updateCardIssuer", (id, body, globalState) => {
});
});
+// ============================================
+// OIDC Authentication Commands
+// ============================================
+
+/**
+ * OIDC Discovery Document call - GET /.well-known/openid-configuration
+ * Validates that the discovery document contains required OIDC fields
+ * Stores discovered token and JWKS endpoints in globalState for subsequent calls
+ */
+Cypress.Commands.add("oidcDiscoveryCallTest", (globalState) => {
+ const baseUrl = globalState.get("baseUrl");
+
+ cy.request({
+ method: "GET",
+ url: `${baseUrl}/.well-known/openid-configuration`,
+ headers: {
+ Accept: "application/json",
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status).to.eq(200);
+ expect(response.body).to.have.property("issuer");
+ expect(response.body).to.have.property("authorization_endpoint");
+ expect(response.body).to.have.property("token_endpoint");
+ expect(response.body).to.have.property("jwks_uri");
+
+ globalState.set("oidcTokenEndpoint", response.body.token_endpoint);
+ globalState.set("oidcJwksUri", response.body.jwks_uri);
+
+ cy.task("cli_log", `Token endpoint: ${response.body.token_endpoint}`);
+ cy.task("cli_log", `JWKS URI: ${response.body.jwks_uri}`);
+ });
+ });
+});
+
+/**
+ * Tests the /oidc/authorize route on the API server.
+ * Hardcoded path with query params for OIDC authorize flow verification.
+ */
+Cypress.Commands.add("oidcAuthorizeRouteCheck", (globalState) => {
+ const baseUrl = globalState.get("baseUrl");
+ const path = `/oidc/authorize?client_id=test&redirect_uri=http://localhost/callback&scope=openid&response_type=code&state=test-state&nonce=test-nonce`;
+
+ cy.request({
+ method: "GET",
+ url: `${baseUrl}${path}`,
+ headers: {
+ Accept: "application/json",
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status).to.be.oneOf([
+ 200, 301, 302, 307, 308, 400, 401, 403,
+ ]);
+
+ cy.task("cli_log", `${path} responded with status ${response.status}`);
+ });
+ });
+});
+
+/**
+ * OIDC JWKS Endpoint call - GET /oauth2/jwks
+ * Fetches the JSON Web Key Set for OIDC token validation.
+ * Asserts 200 with {"keys": [...]} which is the correct behavior when OIDC is enabled.
+ * A 500/OI_05 response indicates a malformed OIDC signing key configuration on the server,
+ * which is a real defect — not an acceptable outcome. That defect should surface as a test
+ * failure rather than being masked.
+ */
+Cypress.Commands.add("oidcJwksCallTest", (globalState) => {
+ const jwksUri = globalState.get("oidcJwksUri");
+ const url = jwksUri || `${globalState.get("baseUrl")}/oauth2/jwks`;
+
+ cy.request({
+ method: "GET",
+ url: url,
+ headers: {
+ Accept: "application/json",
+ },
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status).to.eq(200);
+ expect(response.body).to.have.property("keys");
+ expect(response.body.keys).to.be.an("array");
+ });
+ });
+});
+
+/**
+ * OIDC Token Endpoint Probe call - POST /oauth2/token
+ * Probes the token endpoint to verify it exists and responds appropriately
+ * Does not perform actual token exchange (requires valid auth code)
+ */
+Cypress.Commands.add("oidcTokenEndpointProbeCallTest", (globalState) => {
+ cy.request({
+ method: "POST",
+ url: globalState.get("oidcTokenEndpoint"),
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/x-www-form-urlencoded",
+ },
+ body: "grant_type=authorization_code&code=invalid&redirect_uri=http://localhost/callback",
+ failOnStatusCode: false,
+ }).then((response) => {
+ logRequestId(response.headers["x-request-id"]);
+
+ cy.wrap(response).then(() => {
+ expect(response.status).to.be.oneOf([200, 400, 401, 403]);
+ cy.task(
+ "cli_log",
+ `/oauth2/token responded with status ${response.status} (route exists)`
+ );
+ });
+ });
+});
+
Cypress.Commands.add(
"relayCallTest",
(requestBody, data, globalState, isErrorTest = false) => {