• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger-identus / sdk-ts / 23159132029

16 Mar 2026 06:16PM UTC coverage: 71.673% (-0.03%) from 71.698%
23159132029

push

github

web-flow
fix: linter rules on e2e tests project (#510)

Signed-off-by: Francisco Javier Ribo Labrador <elribonazo@gmail.com>

1387 of 2155 branches covered (64.36%)

Branch coverage included in aggregate %.

3213 of 4263 relevant lines covered (75.37%)

45.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/plugins/internal/oidc/connection/ProcessCallbackUrl.ts
1
import { type AuthServerMetadata } from "../types";
2
import { AuthorizationResponse } from "../protocols/AuthorizationResponse";
3
import * as Utils from "../../../../utils";
4

5
export interface ProcessCallbackUrlArgs {
6
  authServerMeta: AuthServerMetadata;
7
  callbackUrl: URL;
8
  expectedState?: "none" | "skip" | string;
9
}
10

11
export class ProcessCallbackUrl extends Utils.Task<AuthorizationResponse, ProcessCallbackUrlArgs> {
12
  async run() {
13
    const callbackUrl = this.args.callbackUrl;
×
14
    const error = callbackUrl.searchParams.get('error');
×
15

16
    if (Utils.notNil(error)) {
×
17
      throw new Error(JSON.stringify({
×
18
        error,
19
        error_description: callbackUrl.searchParams.get('error_description'),
20
        error_uri: callbackUrl.searchParams.get('error_uri'),
21
      }));
22
    }
23

24
    const code = callbackUrl.searchParams.get("code");
×
25

26
    if (Utils.isEmpty(code)) {
×
27
      throw new Error("no authorization code in callback");
×
28
    }
29

30
    const authGrant = new AuthorizationResponse(callbackUrl, code);
×
31
    const iss = authGrant.issuer;
×
32
    const state = authGrant.state;
×
33

34
    if (Utils.isNil(iss) && this.args.authServerMeta?.authorization_response_iss_parameter_supported) {
×
35
      throw new Error("issuer missing");
×
36
    }
37

38
    if (Utils.notNil(iss) && iss !== this.args.authServerMeta?.issuer) {
×
39
      throw new Error("unexpected issuer");
×
40
    }
41

42
    switch (this.args.expectedState) {
×
43
      case undefined:
44
      case "none":
45
        if (Utils.notNil(state)) {
×
46
          throw new Error('unexpected "state" response parameter encountered');
×
47
        }
48
        break;
×
49
      case "skip":
50
        break;
×
51
      default:
52
        // if (!validateString(expectedState)) {
53
        //   throw new Error('"expectedState" must be a non-empty string')
54
        // }
55
        if (Utils.isNil(state)) {
×
56
          throw new Error('response parameter "state" missing');
×
57
        }
58

59
        if (state !== this.args.expectedState) {
×
60
          throw new Error('unexpected "state" response parameter value');
×
61
        }
62
    }
63

64
    return Promise.resolve(authGrant);
×
65
  }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc