access

package
v0.0.0-...-c131251 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BasicDateFormat     = "20060102T150405Z"
	Algorithm           = "SDK-HMAC-SHA256"
	HeaderXDate         = "X-Sdk-Date"
	HeaderHost          = "host"
	HeaderAuthorization = "Authorization"
	HeaderContentSha256 = "X-Sdk-Content-Sha256"
)

Variables

This section is empty.

Functions

func AuthHeaderValue

func AuthHeaderValue(signature, accessKey string, signedHeaders []string) string

Get the finalized value for the "Authorization" header. The signature parameter is the output from SignStringToSign

func CanonicalHeaders

func CanonicalHeaders(r *http.Request, signerHeaders []string) string

CanonicalHeaders

func CanonicalQueryString

func CanonicalQueryString(r *http.Request) string

CanonicalQueryString

func CanonicalRequest

func CanonicalRequest(r *http.Request, signedHeaders []string) (string, error)

Build a CanonicalRequest from a regular request string

CanonicalRequest =

HTTPRequestMethod + '\n' +
CanonicalURI + '\n' +
CanonicalQueryString + '\n' +
CanonicalHeaders + '\n' +
SignedHeaders + '\n' +
HexEncode(Hash(RequestPayload))

func CanonicalURI

func CanonicalURI(r *http.Request) string

CanonicalURI returns request uri

func HexEncodeSHA256Hash

func HexEncodeSHA256Hash(body []byte) (string, error)

HexEncodeSHA256Hash returns hexcode of sha256

func RequestPayload

func RequestPayload(r *http.Request) ([]byte, error)

RequestPayload

func SignStringToSign

func SignStringToSign(stringToSign string, signingKey []byte) (string, error)

Create the HWS Signature.

func SignedHeaders

func SignedHeaders(r *http.Request) []string

SignedHeaders

func StringToSign

func StringToSign(canonicalRequest string, t time.Time) string

Create a "String to Sign".

Types

type AccessService

type AccessService struct {
	// contains filtered or unexported fields
}

func NewAccessService

func NewAccessService(authInfo *param.AuthInfo) *AccessService

func NewAccessServiceWithProxy

func NewAccessServiceWithProxy(authInfo *param.AuthInfo, proxyHostInfo *param.ProxyHostInfo) *AccessService

func (*AccessService) Delete

func (accessService *AccessService) Delete(url string, body string) (*http.Response, error)

func (*AccessService) Get

func (accessService *AccessService) Get(url string) (*http.Response, error)

func (*AccessService) Post

func (accessService *AccessService) Post(url string, header map[string]string, body io.Reader) (*http.Response, error)

func (*AccessService) Put

func (accessService *AccessService) Put(url string, body string) (*http.Response, error)

type Signer

type Signer struct {
	AppKey    string
	AppSecret string
}

Signature HWS meta

func (*Signer) Sign

func (s *Signer) Sign(r *http.Request) error

SignRequest set Authorization header

Jump to

Keyboard shortcuts

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