signature

package
v0.0.0-...-4b38c65 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package signature verify request for any AWS service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeAPIErrorToResponse

func EncodeAPIErrorToResponse(err APIError) []byte

EncodeAPIErrorToResponse encodes APIerror to http response

func EncodeResponse

func EncodeResponse(response interface{}) []byte

EncodeResponse encodes the response headers into XML format.

func ReloadKeys

func ReloadKeys(pairs map[string]string)

func StoreKeys

func StoreKeys(pairs map[string]string)

LoadKeys parse and store accessKey-secretKey pair

Types

type APIError

type APIError struct {
	Code           string
	Description    string
	HTTPStatusCode int
}

APIError is API Error structure

func GetAPIError

func GetAPIError(errCode ErrorCode) APIError

GetAPIError decodes Signerror[int] to APIerror[encodable]

type Credentials

type Credentials struct {
	AccessKey    string                 `xml:"AccessKeyId" json:"accessKey,omitempty"`
	SecretKey    string                 `xml:"SecretAccessKey" json:"secretKey,omitempty"`
	Expiration   time.Time              `xml:"Expiration" json:"expiration,omitempty"`
	SessionToken string                 `xml:"SessionToken" json:"sessionToken,omitempty"`
	Status       string                 `xml:"-" json:"status,omitempty"`
	ParentUser   string                 `xml:"-" json:"parentUser,omitempty"`
	Groups       []string               `xml:"-" json:"groups,omitempty"`
	Claims       map[string]interface{} `xml:"-" json:"claims,omitempty"`
}

Credentials holds access and secret keys.

type ErrorCode

type ErrorCode int

ErrorCode is code[int] of APIError

const (

	// ErrNone is None(err=nil)
	ErrNone ErrorCode
)

func GetAccessKey

func GetAccessKey(v4Auth string) (accessKey string, err ErrorCode)

func V4SignVerify

func V4SignVerify(r *http.Request) ErrorCode

V4SignVerify - Verify authorization header with calculated header in accordance with

returns nil if signature matches.

Jump to

Keyboard shortcuts

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