Skip to main content

CLI for managing user authentication when using IQM quantum computers

Project description

CI badge Release badge Black badge

Cortex CLI

Command-line interface (CLI) for managing user authentication when using IQM quantum computers.

Installing Cortex CLI

Requirements for installing:

  • Python 3.9

  • pip

$ pip install iqm-cortex-cli

Using Cortex CLI

For general usage instructions, run

$ cortex --help

Initialization

First, Cortex CLI needs initialization, which produces a configuration file:

$ cortex init

Cortex CLI will ask a few questions. You can also pass the values via command line to avoid having an interactive prompt. See cortex init --help for details.

Login

To log in, use

$ cortex auth login

This will ask you to enter your username and password. If you have a temporary password you will be asked to enter a new one.

After a successful authentication, tokens will be saved into a tokens file (path specified in the configuration file), and a token manager daemon will start in the background. Token manager will periodically refresh the session and re-write the tokens file.

To use the token manager in a foreground mode (not as daemon), run cortex auth login --no-daemon. This requires keeping the shell session alive. However, you can start the process in the background by adding & after the command: cortex auth login --no-daemon &. This applies to Bash, zsh and similar shells, but may not be available on all shells.

To login and get tokens once, without starting a token manager at all, run cortex auth login --no-refresh.

If the tokens file already exists, then running cortex auth login will first attempt to refresh the session without asking you for a username and password. If that fails (because existing tokens may already have expired), you’ll be asked to re-enter your credentials.

See cortex auth login --help for more details.

Use with Cirq on IQM, Qiskit on IQM, etc.

Adapters based on IQM Client, such as Cirq on IQM and Qiskit on IQM, can take advantage of the tokens file maintained by Cortex CLI. This way you won’t need to provide the authentication server URL, username, or password to the adapter library itself. To achieve this, follow the instructions printed on the screen after running cortex auth login. Namely, set the IQM_TOKENS_FILE environment variable to point to your tokens file, for example:

$ export IQM_TOKENS_FILE=/home/user/iqm_tokens.json

Once set, this environment variable is read by the instance of IQM Client associated with the adapter. As a result, from the point of view of the adapter it looks like authentication is simply not required (i.e. no authentication-related information has to be provided to the adapter).

Status

To see the current status of the token manager, use:

$ cortex auth status

If the tokens file exists, cortex auth status will report whether the corresponding token manager is running. It will also print the time of the last successful refresh request, and how much time is left until current tokens expire.

See cortex auth status --help for more details.

Logout

To log out, run

$ cortex auth logout

This will send a logout request to the authentication server, kill the token manager daemon (if any), and delete the tokens file.

You may want to stop the token manager, but maintain the session on the server and keep the tokens file intact. To do so, run:

$ cortex auth logout --keep-tokens

See cortex auth logout --help for more details.

Multiple configuration files

By default, all Cortex CLI commands read the configuration file from the default location ~/.config/iqm-cortex-cli/config.json. You can specify a different filepath by providing the --config-file value, for example:

$ cortex auth status --config-file /home/joe/config.json
$ cortex auth login --config-file /home/joe/config.json
$ cortex auth logout --config-file /home/joe/config.json

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iqm-cortex-cli-4.5.tar.gz (666.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iqm_cortex_cli-4.5-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file iqm-cortex-cli-4.5.tar.gz.

File metadata

  • Download URL: iqm-cortex-cli-4.5.tar.gz
  • Upload date:
  • Size: 666.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for iqm-cortex-cli-4.5.tar.gz
Algorithm Hash digest
SHA256 5a88acd911e48f8e534c6e0001e3d4949eb2e75575052499407698cede1b0586
MD5 5ea0d41a6db4ea07725499de6ee99e33
BLAKE2b-256 491d7e84b3a78097bba4cb21ee957b64e0cb9c8c58a812f54719804f6973cad6

See more details on using hashes here.

File details

Details for the file iqm_cortex_cli-4.5-py3-none-any.whl.

File metadata

  • Download URL: iqm_cortex_cli-4.5-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for iqm_cortex_cli-4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 322c3d8d12e5796b6df415237c8ae0b0e1b119110a33ece8b8486770110c51f8
MD5 3f82e19ef89fe36d597e48941be237d6
BLAKE2b-256 b8fa3967d0d4fc045b400d82fd246e4888fbf50f0f5ba59f81c2a2418cab1f98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page