auth

package
v0.0.0-...-3eb6894 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signature

type Signature struct {
	AppId       string
	Bucket      string
	SecretId    string
	ExpiredTime string
	CurrentTime string
	Rand        string
	FileId      string
}

生成签名, 腾讯移动服务通过签名来验证请求的合法性, 开发者通过将签名授权给客户端, 使其具备上传下载及管理指定资源的能力, 签名分为多次有效签名和单次有效签名. 生成签名所需信息包括项目 ID(AppId),空间名称(Bucket,文件资源的组织管理单元),项目的 Secret ID 和 Secret Key, 获取这些信息的方法如下: 1) 登录 云对象存储, 进入云对象存储空间; 2) 如开发者未创建空间,可添加空间,空间名称(Bucket)由用户自行输入 3) 点击“获取secretKey”,获取 Appid,Secret ID 和 Secret Key

func NewSignature

func NewSignature(appId, bucket, secretId, expiredTime, currentTime, rand, fileId string) *Signature

构造签名类, 可使用该类的 Sign 和 SignOnce 接口分别进行多次有效签名和单次有效签名

func (*Signature) Sign

func (s *Signature) Sign(secretKey string) string

多次有效签名, secretKey 为项目的 Secret Key

func (*Signature) SignOnce

func (s *Signature) SignOnce(secretKey string) string

单次有效签名, secretKey 为项目的 Secret Key

func (*Signature) String

func (s *Signature) String() string

字符串签名类

type Signer

type Signer interface {
	Sign(secretKey string) (string, error)
	SignOnce(secretKey string) (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL