:class:`~.CredentialManager` =================================================================================================================================================== .. py:class:: astropathdb.db_io.credentials.CredentialManager(store = None) :single-line-parameter-list: Bases: :class:`~.sidus.io._utils.PathUtils` Select one credential source and complete only its own account via keyring. :class:`~.astropathdb.db_io.credentials.CredentialManager` *Properties* --------------------------------------------------------------------------------------------------------------------------------------------------- .. autoapisummary:: :signatures: none astropathdb.db_io.credentials.CredentialManager.stores_keyring :class:`~.astropathdb.db_io.credentials.CredentialManager` *Methods* --------------------------------------------------------------------------------------------------------------------------------------------------- .. autoapisummary:: :signatures: none astropathdb.db_io.credentials.CredentialManager.resolve astropathdb.db_io.credentials.CredentialManager.check_store astropathdb.db_io.credentials.CredentialManager.save astropathdb.db_io.credentials.CredentialManager.login :class:`~.astropathdb.db_io.credentials.CredentialManager` *References* --------------------------------------------------------------------------------------------------------------------------------------------------- .. py:currentmodule:: astropathdb.db_io.credentials.CredentialManager *Property Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:property:: stores_keyring :type: bool Whether a successful login saves the resolved pair to keyring. *Method Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:method:: resolve(username = None, password = None, *, token = None, credential_filename = None, existing_token = None) :single-line-parameter-list: Resolve the first selected source; never fall through after selecting an account. .. py:method:: check_store(credentials) :single-line-parameter-list: Preflight keyring storage before authentication changes process state. .. py:method:: save(credentials, token) :single-line-parameter-list: Store an authenticated session; a failed keyring write prevents token export. .. py:method:: login(username = None, password = None, *, token = None, credential_filename = None) :single-line-parameter-list: 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; ``token`` registers an explicit token without a login request. The manager's ``store`` is checked before activation changes process state and written after it. :raises CasJobsLoginError: No active token was obtained. *Private Attribute Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:attribute:: _store :value: None .. py:attribute:: _backend :type: keyring.backend.KeyringBackend | None :value: None .. py:attribute:: _backend_error :type: type[Exception] *Private Method Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:method:: _environment_value(name) :single-line-parameter-list: :staticmethod: Treat empty environment values as absent while preserving nonempty values. .. py:method:: _read_dotenv(contents) :single-line-parameter-list: :staticmethod: Parse dotenv fields in one pass, rejecting a partially parsed file. .. py:method:: _read_json(contents) :single-line-parameter-list: :staticmethod: Parse a JSON object whose credential fields are strings or null. .. py:method:: _read_text(contents) :single-line-parameter-list: :staticmethod: Parse the legacy username and password lines, stripping each. .. py:method:: _activate(credentials) :single-line-parameter-list: :staticmethod: 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. .. py:method:: _keyring(*, required) :single-line-parameter-list: Select an available backend once, so a later save uses the checked backend. .. py:method:: _stored_password(username) :single-line-parameter-list: Return this account's keyring password; an inaccessible keyring has none. .. py:method:: _credentials(username = None, password = None, token = None) :single-line-parameter-list: Prefer the source's token, otherwise complete its own account's password. .. py:method:: _read_file(path) :single-line-parameter-list: Parse an existing credential file by its suffix without logging its contents.