qiniu v0.3.2 Qiniu.Auth

Module about authorization.

See http://developer.qiniu.com/docs/v6/api/reference/security/

Summary

Functions

Get authorized download url from plain url(host + key)

Get authorized download url from host and key

Generate token for uploading, which can be used in client or just server

Functions

access_token(url, body \\ "")

Get access token

Fields

  • url - e.g. http://rs.qiniu.com/move/bmV3ZG9jczpmaW5kX21hbi50eHQ=/bmV3ZG9jczpmaW5kLm1hbi50eHQ=
  • body - HTTP body, "" by default
authorize_download_url(url, expires_in)

Get authorized download url from plain url(host + key)

Fields

  • url - e.g. http://my-bucket.qiniudn.com/prefix/sunflower.jpg
  • expires_in - seconds to expire
authorize_download_url(host, key, expires_in)

Get authorized download url from host and key

Fields

  • host - e.g. http://my-bucket.qiniudn.com
  • key - e.g. prefix/sunflower.jpg
  • expires_in - seconds to expire
generate_uptoken(put_policy)

Specs

generate_uptoken(Qiniu.PutPolicy.t) :: String.t

Generate token for uploading, which can be used in client or just server.

See http://developer.qiniu.com/docs/v6/api/reference/security/upload-token.html

Examples

policy = Qiniu.PutPolicy.build("scope")
uptoken = Qiniu.Auth.generate_uptoken(policy)