pub struct OAuthDpopProof {
pub jti_hash: Digest,
pub seen_at: DateTime<Utc>,
pub client_id: Option<String>,
pub jkt: Option<String>,
pub htm: Option<String>,
pub htu: Option<String>,
pub iat: Option<DateTime<Utc>>,
}Expand description
INTERNAL/DATABASE-ONLY MODEL - DO NOT EXPOSE TO CLIENTS
This struct is a database model that contains a Digest field, which contains raw bytes
and uses custom (de)serialization. This model must never be serialized into external
API payloads or returned directly to clients.
For external-facing responses, use DTOs such as TokenResponse, UserInfoResponse, or
an explicit redacting wrapper that strips or converts Digest fields to safe types (e.g., strings).
Rationale: The Digest type contains sensitive raw bytes and uses custom serialization
that is not suitable for external APIs. Exposing this model directly could leak internal
implementation details or cause serialization issues.
Fields§
§jti_hash: Digest§seen_at: DateTime<Utc>§client_id: Option<String>§jkt: Option<String>§htm: Option<String>§htu: Option<String>§iat: Option<DateTime<Utc>>Implementations§
Source§impl OAuthDpopProof
impl OAuthDpopProof
Sourcepub async fn insert_once(
conn: &mut PgConnection,
jti_hash: Digest,
client_id: Option<&str>,
jkt: Option<&str>,
htm: Option<&str>,
htu: Option<&str>,
iat_epoch: Option<i64>,
) -> ModelResult<bool>
pub async fn insert_once( conn: &mut PgConnection, jti_hash: Digest, client_id: Option<&str>, jkt: Option<&str>, htm: Option<&str>, htu: Option<&str>, iat_epoch: Option<i64>, ) -> ModelResult<bool>
Atomically record this DPoP proof exactly once. Returns:
- Ok(true) => first time seen (ACCEPT)
- Ok(false) => already seen (REPLAY -> REJECT)
Sourcepub async fn find_by_jti_hash(
conn: &mut PgConnection,
jti_hash: Digest,
) -> ModelResult<Option<OAuthDpopProof>>
pub async fn find_by_jti_hash( conn: &mut PgConnection, jti_hash: Digest, ) -> ModelResult<Option<OAuthDpopProof>>
Fetch a stored proof row (for audits/debug).
Sourcepub async fn prune_older_than(
conn: &mut PgConnection,
keep_seconds: i64,
) -> ModelResult<u64>
pub async fn prune_older_than( conn: &mut PgConnection, keep_seconds: i64, ) -> ModelResult<u64>
Delete old entries (call from a periodic task). Returns number of rows removed.
Trait Implementations§
Source§impl Debug for OAuthDpopProof
impl Debug for OAuthDpopProof
Source§impl<'de> Deserialize<'de> for OAuthDpopProof
impl<'de> Deserialize<'de> for OAuthDpopProof
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a, R: Row> FromRow<'a, R> for OAuthDpopProof
impl<'a, R: Row> FromRow<'a, R> for OAuthDpopProof
Auto Trait Implementations§
impl Freeze for OAuthDpopProof
impl RefUnwindSafe for OAuthDpopProof
impl Send for OAuthDpopProof
impl Sync for OAuthDpopProof
impl Unpin for OAuthDpopProof
impl UnwindSafe for OAuthDpopProof
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more