cadrumo.application.auth.session_types module

Provider-neutral records for authenticated AEAT sessions and probes.

class CertificateSessionDetail(**data)[source]

Bases: BaseModel

Certificate identity and protected-resource proof for one session.

Parameters:

data (Any)

kind: Literal[AuthProviderKind.CERTIFICATE]
certificate_thumbprint: str
certificate_subject: str
protected_resource_url: str
class ClaveMovilSessionDetail(**data)[source]

Bases: CLAVE_MOVIL: 'clave_movil'>]]

Session facts unique to a Cl@ve Móvil authentication.

Parameters:
  • kind (Literal[AuthProviderKind.CLAVE_MOVIL])

  • dni_nie (str)

  • landing_url (str | None)

kind: Literal[AuthProviderKind.CLAVE_MOVIL]
used_non_qr_fallback: bool
verification_code: str | None
class ClavePermanenteSessionDetail(**data)[source]

Bases: CLAVE_PERMANENTE: 'clave_permanente'>]]

Session facts unique to a Cl@ve Permanente authentication.

Parameters:
  • kind (Literal[AuthProviderKind.CLAVE_PERMANENTE])

  • dni_nie (str)

  • landing_url (str | None)

kind: Literal[AuthProviderKind.CLAVE_PERMANENTE]
class CertificateLoginAssertionDetail(**data)[source]

Bases: BaseModel

Observed certificate proof for a protected-resource probe.

Parameters:

data (Any)

kind: Literal[AuthProviderKind.CERTIFICATE]
final_url: str | None
response_successful: bool
parsed_subject: str | None
class ClaveMovilLoginAssertionDetail(**data)[source]

Bases: CLAVE_MOVIL: 'clave_movil'>]]

Probe facts for a Cl@ve Móvil session.

Parameters:
  • kind (Literal[AuthProviderKind.CLAVE_MOVIL])

  • session_cookie_present (bool)

  • landing_url (str | None)

kind: Literal[AuthProviderKind.CLAVE_MOVIL]
class ClavePermanenteLoginAssertionDetail(**data)[source]

Bases: CLAVE_PERMANENTE: 'clave_permanente'>]]

Probe facts for a Cl@ve Permanente session.

Parameters:
  • kind (Literal[AuthProviderKind.CLAVE_PERMANENTE])

  • session_cookie_present (bool)

  • landing_url (str | None)

kind: Literal[AuthProviderKind.CLAVE_PERMANENTE]
class AeatLoginAssertion(**data)[source]

Bases: BaseModel

Structured outcome of one live AEAT verification attempt.

Parameters:

data (Any)

target_url: str
is_valid: bool
identity_nif: str | None
status_code: int
elapsed_ms: int
attempted_at: datetime
error_message: str | None
assertion_detail: AuthLoginAssertionDetail
property provider_kind: AuthProviderKind

Return the provider kind declared by the assertion detail.

property response_successful: bool | None

Return the certificate protected-resource response signal.

property final_url: str | None

Return the final protected-resource URL for certificate assertions.

property parsed_subject: str | None

Return the certificate subject when certificate auth produced the assertion.

class AeatSession(**data)[source]

Bases: BaseModel

Authenticated live AEAT session record without secret material.

Parameters:

data (Any)

authenticated_at: datetime
idle_deadline: datetime
storage_state_path: Path | None
identity_nif: str
provider_detail: AuthSessionDetail
property provider_kind: AuthProviderKind

Return the provider kind declared by the session detail.

property certificate_thumbprint: str | None

Return the certificate thumbprint for certificate-backed sessions.

property certificate_subject: str | None

Return the certificate subject for certificate-backed sessions.

is_stale(now=None)[source]

Return whether the idle deadline has elapsed at now.

Return type:

bool

Parameters:

now (datetime | None)

is_exact_active_provider_session(session, active_session, *, provider_kind, detail_type)[source]

Return whether session is the provider’s exact retained session.

Return type:

bool

Parameters: