aeat.application.auth._apoderado module¶
Apoderado application service.
Operator verbs:
statusRead-only summary of the active apoderado configuration.
configureSet
--represented-nif NIF --scope SCOPE(repeated).clearRetire the apoderado configuration for the active bucket.
checkLive verification of the stored apoderamiento against the AEAT sede. The live-read path is not wired, so this verb refuses with
ApoderadoLiveCheckUnavailableError; usestatusfor the offline configuration read.
Configuration is persisted per-bucket as an encrypted
adapters.persistence.storage.Envelope row in the
adapters.persistence.storage.SecureObjectRepository under
adapters.persistence.storage.AUTH_APODERADO_CONFIGURATION_NAMESPACE.
The represented_nif is an
identity-bearing tax identifier, so the record carries
adapters.persistence.storage.SensitivityClass IDENTITY and
is encrypted at rest; the service never writes plaintext to disk. Live mutation
of AEAT-side apoderamiento state (registrar, ampliar, revocar, confirmar,
renunciar, presentar-en-representacion) is permanently refused at this boundary;
the service has no verb that would write to AEAT.
- exception ApoderadoConfigurationNotSetError(message=None, *, context=None, suggestion=None, translated_message=None)[source]¶
Bases:
AeatErrorRaised when status or check runs without a configured apoderado.
- Parameters:
- Return type:
None
- code: ClassVar[ErrorCode]¶
Bases:
AeatErrorRaised when the live-read path is not yet wired or AEAT contact fails.
- Parameters:
- Return type:
None
- class ApoderadoConfiguration(**data)[source]¶
Bases:
BaseModelPersisted apoderado configuration for one bucket.
- Parameters:
- bucket_id: BucketId¶
- represented_nif: str¶
- granted_scopes: tuple[str, ...]¶
- catalogue_version: str¶
- configured_at: datetime¶
- notes: str¶
- class ApoderadoStatus(**data)[source]¶
Bases:
BaseModelRead-only status surface returned by
apoderado status.- Parameters:
- bucket_id: BucketId¶
- configured: bool¶
- represented_nif: str | None¶
- granted_scopes: tuple[str, ...]¶
- catalogue_version: str | None¶
- configured_at: datetime | None¶
- class ApoderadoService(settings=None, catalogue=None)[source]¶
Bases:
objectLocal apoderado configuration management.
Live AEAT mutation is permanently refused at this boundary.
checkperforms read-only verification only; the actual remote contact is a sealed extension point.- Parameters:
settings (Settings | None)
catalogue (ApoderamientosCatalogue | None)
- property catalogue: ApoderamientosCatalogue¶
Return the AEAT apoderamiento scope
ApoderamientosCataloguein use by this service.
- status(*, bucket_id)[source]¶
Return the current
ApoderadoStatusforbucket_id.Reads the persisted
ApoderadoConfiguration(if any) and projects it into a read-only status record. Does not contact AEAT.- Parameters:
bucket_id (
str) – The profile bucket’s UUIDv4 identifier.- Return type:
- configure(*, bucket_id, represented_nif, scope_tokens, notes='')[source]¶
Persist apoderado config and return the resulting
ApoderadoConfiguration.Validates and dedups scopes against the catalogue.
- check(*, bucket_id)[source]¶
Read-only live verification (sealed pending live-read wiring).
checkis the live-verification verb: it would contact the AEAT sede to confirm the stored apoderamiento is still granted. That live-read path is not wired (live AEAT reads are refused at this boundary per the safety gate), socheckraisesApoderadoLiveCheckUnavailableErrorunconditionally rather than silently re-reading stored configuration and presenting it as a live result. Usestatusfor the offline configuration read.Returns the live
ApoderadoStatusonce the live-read path is wired; until then it raises.- Raises:
ApoderadoLiveCheckUnavailableError – always, until the live-read path is wired.
- Return type:
- Parameters:
bucket_id (str)