CredentialManager#
- class astropathdb.db_io.credentials.CredentialManager(store=None)#
Bases:
PathUtilsSelect one credential source and complete only its own account via keyring.
- Parameters:
store (CredentialStore | None)
CredentialManager Properties#
Whether a successful login saves the resolved pair to keyring. |
CredentialManager Methods#
|
Resolve the first selected source; never fall through after selecting an account. |
|
Preflight keyring storage before authentication changes process state. |
|
Store an authenticated session; a failed keyring write prevents token export. |
|
Select, activate, and store one SciScript session, returning its token. |
CredentialManager References#
Property Reference#
Method Reference#
- method resolve(username=None, password=None, *, token=None, credential_filename=None, existing_token=None)#
Resolve the first selected source; never fall through after selecting an account.
- method check_store(credentials)#
Preflight keyring storage before authentication changes process state.
- Parameters:
credentials (Credentials)
- Return type:
None
- method save(credentials, token)#
Store an authenticated session; a failed keyring write prevents token export.
- Parameters:
credentials (Credentials)
token (str)
- Return type:
None
- method login(username=None, password=None, *, token=None, credential_filename=None)#
Select, activate, and store one SciScript session, returning its token.
Compute reuses its managed session. Elsewhere, explicit inputs are resolved without the existing session, which only a bare call may reuse;
tokenregisters an explicit token without a login request. The manager’sstoreis checked before activation changes process state and written after it.
Private Attribute Reference#
- attribute _store = None#
- attribute _backend: KeyringBackend | None = None#
Private Method Reference#
- static _environment_value(name)#
Treat empty environment values as absent while preserving nonempty values.
- static _read_dotenv(contents)#
Parse dotenv fields in one pass, rejecting a partially parsed file.
- static _read_json(contents)#
Parse a JSON object whose credential fields are strings or null.
- static _read_text(contents)#
Parse the legacy username and password lines, stripping each.
- static _activate(credentials)#
Register the selected credentials with SciScript, returning its active token.
A reused token is returned without a request. Raw SciScript errors are replaced because they can carry the password or response body.
- Parameters:
credentials (Credentials)
- Return type:
str | None
- method _keyring(*, required)#
Select an available backend once, so a later save uses the checked backend.
- Parameters:
required (bool)
- Return type:
KeyringBackend | None
- method _stored_password(username)#
Return this account’s keyring password; an inaccessible keyring has none.
- method _credentials(username=None, password=None, token=None)#
Prefer the source’s token, otherwise complete its own account’s password.
- Parameters:
- Return type:
- method _read_file(path)#
Parse an existing credential file by its suffix without logging its contents.
- Parameters:
- Return type: