pub struct UrlSigner<D, S> { /* private fields */ }
Expand description

A generator for signed URLs, which can be used to grant temporary access to specific storage resources even if the client making the request is not otherwise logged in or normally able to access to the storage resources in question.

This implements the V4 signing process

Implementations§

source§

impl<D, S> UrlSigner<D, S>
where D: DigestCalulator, S: Signer,

source

pub fn new(digester: D, signer: S) -> Self

Creates a new UrlSigner from a [DigestCalculator] implementation capable of generating SHA256 digests of buffers, and a Signer capable of doing RSA-SHA256 encryption. You may implement these on your own using whatever crates you prefer, or you can use the signing feature which will use the excellent ring crate to provide implementations.

source

pub fn generate<'a, K, OID>( &self, key_provider: &K, id: &OID, optional: SignedUrlOptional<'_> ) -> Result<Url, Error>
where K: KeyProvider, OID: ObjectIdentifier<'a>,

Generates a new signed url for the specified resource, using a key provider. Note that this operation is entirely local, so though this may succeed in generating a url, the actual operation using it may fail if the account used to sign the URL does not have sufficient permissions for the resource. For example, if you provided a GCP service account that had devstorage.read_only permissions for the bucket/object, this method would succeed in generating a signed url for a POST operation, but the actual POST using that url would fail as the account does not itself have permissions for the POST operation.

Auto Trait Implementations§

§

impl<D, S> Freeze for UrlSigner<D, S>
where D: Freeze, S: Freeze,

§

impl<D, S> RefUnwindSafe for UrlSigner<D, S>

§

impl<D, S> Send for UrlSigner<D, S>
where D: Send, S: Send,

§

impl<D, S> Sync for UrlSigner<D, S>
where D: Sync, S: Sync,

§

impl<D, S> Unpin for UrlSigner<D, S>
where D: Unpin, S: Unpin,

§

impl<D, S> UnwindSafe for UrlSigner<D, S>
where D: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.