AuthPolicy

Labs

class AuthPolicy

Description

How to authenticate against indexes. Build one with the static constructors; the default for every call is none().

Opening the OS credential store can raise a keychain prompt on some platforms, so a library call never does it unasked: only from_env() with the default keyring=True opts in.

Inheritance:

Members defined in AuthPolicy (5 members)

kind

R

basic

HTTP basic credentials for every URL matching url_glob.

bearer

A bearer token for every URL matching url_glob. Globs do not cross /: use https://index.example/** for a whole host. label is the name error messages use for this credential.

from_env

The CLI’s own resolution: validated SYSAND_CRED_<LABEL> groups (SYSAND_CRED_<LABEL> holds the URL glob, ..._BEARER_TOKEN or ..._BASIC_USER/..._BASIC_PASSWORD the credential), composed with the OS credential store sysand auth login writes unless keyring=False. Environment variables alone can never prompt. The variables are read when a call is made, not here.

none

No credentials at all; a 401/403 raises AuthError.

Attributes

property kind: str

Methods

static basic(*, url_glob: str, username: str, password: str) → syside.experimental.remote.AuthPolicy

HTTP basic credentials for every URL matching url_glob.

static bearer(*, url_glob: str, token: str, label: str = 'python') → syside.experimental.remote.AuthPolicy

A bearer token for every URL matching url_glob. Globs do not cross /: use https://index.example/** for a whole host. label is the name error messages use for this credential.

static from_env(*, keyring: bool = True) → syside.experimental.remote.AuthPolicy

The CLI’s own resolution: validated SYSAND_CRED_<LABEL> groups (SYSAND_CRED_<LABEL> holds the URL glob, ..._BEARER_TOKEN or ..._BASIC_USER/..._BASIC_PASSWORD the credential), composed with the OS credential store sysand auth login writes unless keyring=False. Environment variables alone can never prompt. The variables are read when a call is made, not here.

static none() → syside.experimental.remote.AuthPolicy

No credentials at all; a 401/403 raises AuthError.