aeat.adapters.outbound.google._session_store module¶
Encrypted Google record persistence.
This module writes Google records through
adapters.persistence.storage.SecureObjectRepository.
Five per-profile record families back Google configuration and session state,
each under the namespace and
adapters.persistence.storage.SensitivityClass declared by the
storage registry:
adapters.persistence.storage.GOOGLE_OAUTH_CLIENT_NAMESPACEstores the operator-importedadapters.outbound.google.OAuthClientatSECRETsensitivity becauseclient_secretis a long-lived credential.adapters.persistence.storage.GOOGLE_OAUTH_TOKEN_NAMESPACEstores the refreshadapters.outbound.google.OAuthTokenreturned byadapters.outbound.google.run_login_flow()atSECRETsensitivity.adapters.persistence.storage.GOOGLE_OAUTH_METADATA_NAMESPACEstores the non-secretadapters.outbound.google.OAuthMetadataaccount, scope, issuance, refresh, and reauth audit fields atFINANCIALsensitivity.adapters.persistence.storage.GOOGLE_DRIVE_CONFIG_NAMESPACEstores theadapters.outbound.google.DriveConfigroot folder selection used byadapters.outbound.storage.get_storage_provider()atFINANCIALsensitivity.adapters.persistence.storage.GOOGLE_CREDENTIAL_SOURCE_NAMESPACEstores theadapters.outbound.google.GoogleCredentialSourceSelectionchoice ofcore.GoogleCredentialSourceKind(and, for service-account impersonation, the target SA email/scopes) atFINANCIALsensitivity — configuration only, never a credential.
The public helpers use the profile identifier resolved by
adapters.outbound.google.resolve_active_profile() as the storage
object key, matching the {profile} grammar on all five namespace
definitions.
- save_client(profile, client)[source]¶
Persist an
adapters.outbound.google.OAuthClientforprofile.The record is written under
adapters.persistence.storage.GOOGLE_OAUTH_CLIENT_NAMESPACEwithadapters.persistence.storage.SensitivityClassSECRETsoaeat config google loginand Drive credential hydration can reload the operator-imported Desktop OAuth client.- Return type:
- Parameters:
profile (str)
client (OAuthClient)
- load_client(profile)[source]¶
Load the
adapters.outbound.google.OAuthClientforprofile.- Return type:
- Returns:
The stored
adapters.outbound.google.OAuthClient, orNonewhen the profile has not registered a Desktop OAuth client.- Parameters:
profile (str)
- save_token(profile, token)[source]¶
Persist an
adapters.outbound.google.OAuthTokenforprofile.The token is written under
adapters.persistence.storage.GOOGLE_OAUTH_TOKEN_NAMESPACEwithadapters.persistence.storage.SensitivityClassSECRET. The CLI saves this afteradapters.outbound.google.run_login_flow(), and refresh code may overwrite it when Google rotates the refresh token.- Return type:
- Parameters:
profile (str)
token (OAuthToken)
- load_token(profile)[source]¶
Load the
adapters.outbound.google.OAuthTokenforprofile.- Return type:
- Returns:
The stored
adapters.outbound.google.OAuthToken, orNonewhen the profile has no active Google login session.- Parameters:
profile (str)
- save_metadata(profile, metadata)[source]¶
Persist
adapters.outbound.google.OAuthMetadataforprofile.Metadata is non-secret companion state for
adapters.outbound.google.OAuthToken: account email, granted scopes, issue/refresh timestamps, and reauth status. It is written underadapters.persistence.storage.GOOGLE_OAUTH_METADATA_NAMESPACEwithadapters.persistence.storage.SensitivityClassFINANCIAL.- Return type:
- Parameters:
profile (str)
metadata (OAuthMetadata)
- load_metadata(profile)[source]¶
Load the
adapters.outbound.google.OAuthMetadataforprofile.- Return type:
- Returns:
The stored
adapters.outbound.google.OAuthMetadata, orNonewhen no metadata record exists for the profile.- Parameters:
profile (str)
- save_drive_config(profile, config)[source]¶
Persist the per-profile
adapters.outbound.google.DriveConfig.The config is written under
adapters.persistence.storage.GOOGLE_DRIVE_CONFIG_NAMESPACEwithadapters.persistence.storage.SensitivityClassFINANCIALsoadapters.outbound.storage.get_storage_provider()can resolve the Drive root folder without re-reading environment-only configuration.- Return type:
- Parameters:
profile (str)
config (DriveConfig)
- load_drive_config(profile)[source]¶
Load the per-profile
adapters.outbound.google.DriveConfig.- Return type:
- Returns:
The stored
adapters.outbound.google.DriveConfig, orNonewhen the profile has no persisted Drive root folder selection.- Parameters:
profile (str)
- save_credential_source_selection(profile, selection)[source]¶
Persist the per-profile
adapters.outbound.google.GoogleCredentialSourceSelection.The record is written under
adapters.persistence.storage.GOOGLE_CREDENTIAL_SOURCE_NAMESPACEwithadapters.persistence.storage.SensitivityClassFINANCIALsoadapters.outbound.storage.build_google_credentials()can dispatch to the chosencore.GoogleCredentialSourceKindwithout re-reading environment-only configuration. No long-lived secret rides on this record: the impersonated access token is re-derived from Application Default Credentials on every use and is never persisted.- Return type:
- Parameters:
profile (str)
selection (GoogleCredentialSourceSelection)
- load_credential_source_selection(profile)[source]¶
Load the per-profile
adapters.outbound.google.GoogleCredentialSourceSelection.- Return type:
- Returns:
The stored
adapters.outbound.google.GoogleCredentialSourceSelection, orNonewhen the profile has no persisted selection. ANoneresult means the defaultcore.GoogleCredentialSourceKind.OAUTH_DESKTOPpath applies — callers must not treat a missing record as an error.- Parameters:
profile (str)
- delete_session(profile)[source]¶
Delete the login session while preserving registration and Drive config.
Removes only the
adapters.persistence.storage.GOOGLE_OAUTH_TOKEN_NAMESPACEandadapters.persistence.storage.GOOGLE_OAUTH_METADATA_NAMESPACErecords, matchingaeat config google logout. The registeredadapters.outbound.google.OAuthClientandadapters.outbound.google.DriveConfigremain available so a later login can reuse the Cloud Console JSON and the same Drive root folder.