pub trait UploadTokenProvider: DynClone + Debug + Sync + Send {
fn access_key(
&self,
opts: GetAccessKeyOptions
) -> Result<GotAccessKey, ParseError>;
fn policy(
&self,
opts: GetPolicyOptions
) -> Result<GotUploadPolicy<'_>, ParseError>;
fn to_token_string(
&self,
opts: ToStringOptions
) -> Result<Cow<'_, str>, Error>;
fn async_access_key(
&self,
opts: GetAccessKeyOptions
) -> Pin<Box<dyn Future<Output = Result<GotAccessKey, ParseError>> + Send, Global>> { ... }
fn async_policy(
&self,
opts: GetPolicyOptions
) -> Pin<Box<dyn Future<Output = Result<GotUploadPolicy<'_>, ParseError>> + Send, Global>> { ... }
fn async_to_token_string(
&self,
opts: ToStringOptions
) -> Pin<Box<dyn Future<Output = Result<Cow<'_, str>, Error>> + Send, Global>> { ... }
}Expand description
上传凭证获取接口
可以阅读 https://developer.qiniu.com/kodo/manual/1208/upload-token 了解七牛安全机制。
Required Methods
fn access_key(
&self,
opts: GetAccessKeyOptions
) -> Result<GotAccessKey, ParseError>
fn access_key(
&self,
opts: GetAccessKeyOptions
) -> Result<GotAccessKey, ParseError>
从上传凭证内获取 AccessKey
该方法的异步版本为 Self::async_access_key。
从上传凭证内获取上传策略
该方法的异步版本为 Self::async_policy。
fn to_token_string(&self, opts: ToStringOptions) -> Result<Cow<'_, str>, Error>
fn to_token_string(&self, opts: ToStringOptions) -> Result<Cow<'_, str>, Error>
生成字符串
该方法的异步版本为 Self::async_to_token_string。
Provided Methods
异步从上传凭证内获取 AccessKey
异步从上传凭证内获取上传策略