schrodinger.application.bunsen.auth module

Authentication helpers for Bunsen connections.

Provides token resolution with a single chokepoint so that all callers use the same precedence: explicit argument > BUNSEN_PAT environment variable > keyring > None.

Also provides secure keyring-based storage for Bunsen Personal Access Tokens, mirroring the pattern in schrodinger.maestro.auth.secure_storage.

schrodinger.application.bunsen.auth.save_token(server_url: str, token: str)

Save a Bunsen PAT to the system keyring.

Parameters:
  • server_url – The Bunsen server URL.

  • token – The PAT to store.

schrodinger.application.bunsen.auth.load_token(server_url: str) str | None

Load a Bunsen PAT from the system keyring.

Parameters:

server_url – The Bunsen server URL.

Returns:

The stored PAT, or None.

schrodinger.application.bunsen.auth.delete_token(server_url: str)

Delete a Bunsen PAT from the system keyring.

Parameters:

server_url – The Bunsen server URL.

schrodinger.application.bunsen.auth.resolve_token(server_url: str, explicit: str | None = None) str | None

Resolve a Bunsen Personal Access Token for server_url.

Precedence: explicit argument > BUNSEN_PAT environment variable > keyring > None.

Parameters:
  • server_url – The Bunsen server URL.

  • explicit – An explicitly provided token that takes top priority.

Returns:

The resolved token, or None if none is available.