Skip to main content

auth

The auth command provides the ability to perform the following actions:

  • register a new OAuth Clients to Checkmarx One user management.

  • validate the OAuth Clients against Checkmarx One.

auth register

The auth register command provides the ability to perform the following:

  1. Create new Oauth2 client in the User Management server from the CLI instead of the User Interface. Please refer to the User Management and Access Control documentation on creating Oauth2 clients from the User Interface.

  2. Authenticate Oauth2 client against the User Management server in Checkmarx One.

Note

Important notes:

  • For creating new OAuth2 client in the User Management server the following is mandatory:

    • The user must be created via User Management interface.

    • The user must be assigned with iam-admin role.

  • For authenticating clients against the User Management server the following is mandatory:

    • The user must have one of the following:

      • Client ID and Secret.

      • API Key.

  • It is possible to retrieve the Client ID and Secret for a specific user using the CLI.

Usage

./cx auth register [flags]

Flags

Name

Default

Description

--help, -h

help for the register command

--username <string>, -u <string>

Username for Checkmarx One user that privileges to create clients

--password <string>, -p <string>

Password for Checkmarx One user that privileges to create clients

--base-uri <string>

Host URL for Checkmarx One server

--roles <string>, -r <string>

A list of roles of the client [ast-admin ast-scanner]

--description <string>, -d <string>

A client description

Examples

Access Key and Secret Authentication

./cx auth register -u <Username> -p <Password> -r <Roles> --base-uri <AST URI>
Create a client in the CLI
[email protected]:/ast$ ./cx auth register -u myuser -p mypassword -r ast-admin,ast-scanner --base-uri https://iam.checkmarx.net/
CX_CLIENT_ID=<generated_client_id>
CX_CLIENT_SECRET=<generated_client_secret>

Note

Configuring the CX_BASE_URI as an environment variable will save the user typing the --base-uri value.

For more information regarding environment variables see Checkmarx One CLI Configuration / Environment Variables

Configure the Client ID and Secret in the default profile
# Configure the Client ID and Client secret
./cx configure
Checkmarx One Base URI [https://ast.checkmarx.net/]:https://ast.checkmarx.net/
Checkmarx One Base Auth URI [https://iam.checkmarx.net/]: https://iam.checkmarx.net/
Checkmarx One Tenant [organization]: mytenant
Do you want to use API Key authentication? (Y/N): n
Checkmarx One Client ID []: <generated_client_id>
Client Secret []: <generated_client_secret>

auth validate

The auth validate command validates a client authentication against Checkmarx One.

Usage

./cx auth validate [flags]

Flags

Name

Default

Description

--help, -h

help for the validate command

Examples

Validating Client Authentication

./cx auth validate
[email protected]:~/ast-cli$ ./cx auth validate
Successfully authenticated to Checkmarx One server!