Source code for cadrumo.application.auth.operator_probe_ports
"""Application-owned capabilities for local operator authentication probes.The operator probe use case only needs three small observations from the outerruntime: whether an active profile session exists, the health facts of a localcertificate bundle, and the kind of a configured Cl@ve identity. Concreteadapter records, enums, and exceptions stay outside this contract; adapterstranslate them into the closed results declared here."""from__future__importannotationsfromdataclassesimportdataclassfromenumimportStrEnumfrompathlibimportPathfromtypingimportProtocolfrompydanticimportSecretStr
[docs]classCertificateHealthBand(StrEnum):"""Application vocabulary for a certificate's expiry health."""OK="ok"WARN="warn"CRITICAL="critical"EXPIRED="expired"
[docs]@dataclass(frozen=True,slots=True)classCertificateHealthObservation:"""Translated health facts required by the application probe."""severity:CertificateHealthBanddays_until_expiry:int
[docs]@dataclass(frozen=True,slots=True)classCertificateHealthFailure:"""Translated certificate-load failure safe for application projection."""detail:str
[docs]@dataclass(frozen=True,slots=True)classCertificateHealthProbeRequest:"""Application-owned input for one certificate health observation."""path:Pathpassword:SecretStrwarn_days:intcritical_days:intfriendly_name:str|None
[docs]classActiveProfileSessionPresencePort(Protocol):"""Observe whether the storage runtime has an active profile session."""
[docs]defis_bound(self)->bool:"""Return whether a profile session is currently bound."""...
[docs]classCertificateHealthProbePort(Protocol):"""Obtain translated health or failure facts for one certificate bundle."""
[docs]defevaluate(self,request:CertificateHealthProbeRequest)->CertificateHealthProbeResult:"""Evaluate the requested bundle without leaking adapter types."""...
[docs]@dataclass(frozen=True,slots=True)classClaveIdentityObservation:"""Translated accepted Cl@ve identity kind (for example, DNI or NIE)."""kind:str
[docs]classClaveIdentityProbePort(Protocol):"""Classify a configured Cl@ve identity at the outbound boundary."""
[docs]defclassify(self,raw:str)->ClaveIdentityProbeResult:"""Return an accepted identity kind or a translated configuration fault."""...
[docs]@dataclass(frozen=True,slots=True)classOperatorProbePorts:"""Required outbound capabilities for all operator authentication probes."""active_profile_session:ActiveProfileSessionPresencePortcertificate_health:CertificateHealthProbePortclave_identity:ClaveIdentityProbePort