pub struct DownloadClaim {
file_upload_id: Uuid,
exp: usize,
iat: usize,
}Expand description
Authorizes the bearer to read one specific host-stored file for a while.
Minted by the host wherever it hands out a URL for a file-typed answer: to an exercise service’s
grade endpoint, and to the views that render a submission. The read-side mirror of
UploadClaim; unlike it, this claim names a single file rather than a namespace, so a holder
cannot reach any other file.
Fields§
§file_upload_id: Uuid§exp: usize§iat: usizeImplementations§
Source§impl DownloadClaim
impl DownloadClaim
pub fn file_upload_id(&self) -> Uuid
Sourcepub fn expiring_in_1_day(file_upload_id: Uuid) -> Self
pub fn expiring_in_1_day(file_upload_id: Uuid) -> Self
A day, not the grading request’s 120 s: a service may finish asynchronously through
grading_update_url long after the request returns.
Sourcepub fn expiring_in_1_hour(file_upload_id: Uuid) -> Self
pub fn expiring_in_1_hour(file_upload_id: Uuid) -> Self
For a URL a person is about to click: long enough to leave the page open for a while, short enough that a copied link is not a lasting handle on someone else’s answer.
fn expiring_in(file_upload_id: Uuid, lifetime: Duration) -> Self
pub fn sign(self, key: &JwtKey) -> Result<String, Error>
pub fn validate(token: &str, key: &JwtKey) -> Result<Self, Error>
Trait Implementations§
Source§impl Debug for DownloadClaim
impl Debug for DownloadClaim
Source§impl<'de> Deserialize<'de> for DownloadClaim
impl<'de> Deserialize<'de> for DownloadClaim
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DownloadClaim
impl RefUnwindSafe for DownloadClaim
impl Send for DownloadClaim
impl Sync for DownloadClaim
impl Unpin for DownloadClaim
impl UnsafeUnpin for DownloadClaim
impl UnwindSafe for DownloadClaim
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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