Documentation
¶
Overview ¶
Package auth credentials.go - the credentials data structure definition
Package auth signer.go - implement the specific sign algorithm of Attains Cloud V1 protocol
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AttainsAuthVersion = "attains-auth-v1" SignJoiner = "\n" SignHeaderJoiner = ";" DefaultExpireSeconds = 1800 DefaultHeadersToSign = map[string]struct{}{ strings.ToLower(metadata.RequestKeyHost): {}, strings.ToLower(metadata.RequestKeyContentLength): {}, strings.ToLower(metadata.RequestKeyContentType): {}, strings.ToLower(metadata.RequestKeyContentMd5): {}, } )
Functions ¶
This section is empty.
Types ¶
type AttainsCredentials ¶
type AttainsCredentials struct { AccessKeyId string // access key id to the service SecretAccessKey string // secret access key to the service }
AttainsCredentials define the data structure for authorization
func NewAttainsCredentials ¶
func NewAttainsCredentials(ak, sk string) (*AttainsCredentials, error)
func (*AttainsCredentials) String ¶
func (a *AttainsCredentials) String() string
type AttainsV1Signer ¶
type AttainsV1Signer struct{}
AttainsV1Signer implements the v1 sign algorithm
func (*AttainsV1Signer) Sign ¶
func (a *AttainsV1Signer) Sign(req *http.Request, ll logger.Interface, cred *AttainsCredentials, opt *SignOptions) error
Sign - generate the authorization string from the AttainsCredentials and SignOptions
PARAMS:
- req: *http.Request for this sign
- cred: *AttainsCredentials to access the service
- opt: *SignOptions for this sign algorithm
type SignOptions ¶
SignOptions defines the data structure used by Signer
func (*SignOptions) String ¶
func (opt *SignOptions) String() string
type Signer ¶
type Signer interface { // Sign the given Request with the Credentials and SignOptions Sign(*http.Request, logger.Interface, *AttainsCredentials, *SignOptions) error }
Signer abstracts the entity that implements the `Sign` method
Click to show internal directories.
Click to hide internal directories.