Handles Bearer Token Authentication for Checkmarx On-Premise REST API requests.

const security = new Security(
'https://checkmarx.example.com',
'my-bearer-token'
);

const headers = security.getHeaders();
// { Authorization: 'Bearer <token>', 'Content-Type': 'application/json', Accept: 'application/json' }

Constructors

  • Creates a new Security instance with Bearer Token Authentication credentials.

    Parameters

    • apiUrl: string

      The base URL of the Checkmarx instance (e.g., https://checkmarx.example.com). Must be a valid URL; throws if it cannot be parsed.

    • token: string

      The bearer token or refresh token to authenticate with

    Returns Security

    If apiUrl is not a valid URL

Methods

  • Returns the base URL of the Checkmarx instance, without a trailing slash.

    Returns string

    The API base URL

  • Returns the value of the Authorization header for Bearer Authentication.

    Returns string

    The Authorization header value in the format Bearer <access_token>

  • Returns the full set of HTTP headers required for authenticated API requests.

    Returns Record<string, string>

    An object containing Authorization, Content-Type, and Accept headers

  • Updates the Authorization header with a new access token obtained from the auth endpoint. Called automatically by CheckmarxClient.authenticate after a successful token exchange.

    Parameters

    • tokenType: string

      The token type returned by the auth endpoint (e.g., 'Bearer')

    • accessToken: string

      The access token returned by the auth endpoint

    Returns void