s3auth

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignV4

func SignV4(req http.Request, accessKey, secretAccessKey, location string, body io.Reader) *http.Request

SignV4 sign the request before Do(), in accordance with http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html.

Types

type IAccessKeySecretRequest

type IAccessKeySecretRequest interface {
	GetAccessKey() string
	Validate() error
	ParseRequest(req http.Request, virtualHost bool) error
	Verify(secret string) error
	Encode() string
}

func Decode

func Decode(reqStr string) (IAccessKeySecretRequest, error)

func DecodeAccessKeyRequest

func DecodeAccessKeyRequest(req http.Request, virtualHost bool) (IAccessKeySecretRequest, error)

type SAccessKeyRequest

type SAccessKeyRequest struct {
	Algorithm string `json:"algorithm,omitempty"`
	AccessKey string `json:"access_key,omitempty"`
	Signature string `json:"signature,omitempty"`
	Request   string `json:"request,omitempty"`
}

func (SAccessKeyRequest) GetAccessKey

func (aksk SAccessKeyRequest) GetAccessKey() string

func (SAccessKeyRequest) Validate

func (aksk SAccessKeyRequest) Validate() error

type SAccessKeyRequestV2

type SAccessKeyRequestV2 struct {
	SAccessKeyRequest
}

func NewV2Request

func NewV2Request() SAccessKeyRequestV2

func (SAccessKeyRequestV2) Encode

func (aksk SAccessKeyRequestV2) Encode() string

func (*SAccessKeyRequestV2) ParseRequest

func (aksk *SAccessKeyRequestV2) ParseRequest(req http.Request, virtualHost bool) error

func (SAccessKeyRequestV2) Verify

func (aksk SAccessKeyRequestV2) Verify(secret string) error

type SAccessKeyRequestV4

type SAccessKeyRequestV4 struct {
	SAccessKeyRequest
	Location      string
	SignedHeaders []string
	SignDate      time.Time
}

func NewV4Request

func NewV4Request() SAccessKeyRequestV4

func (SAccessKeyRequestV4) Encode

func (aksk SAccessKeyRequestV4) Encode() string

func (*SAccessKeyRequestV4) ParseRequest

func (aksk *SAccessKeyRequestV4) ParseRequest(req http.Request, virtualHost bool) error

func (SAccessKeyRequestV4) Verify

func (aksk SAccessKeyRequestV4) Verify(secret string) error

Jump to

Keyboard shortcuts

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