s3sign

package module
v0.0.0-...-e48afab Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: MIT Imports: 6 Imported by: 0

README

Amazon S3 Signed Request with STS

This package enables you to create signed requests with STS to Amazon S3 for uploading files. AWS Signature Version 4 is the recommended approach to create signed requests. The signature can be created using your access keys (access key ID, secret access key). The Amazon Security Token Service (STS) provides temporary security credentials. This package use the credentials created using STS to sign request.

In fact, this package doesn't make the actual request. This package creates all the values required to make signed request. Application authors can use this library and send the values produced here to the authenticated users. The client (web or mobile application) can get these values and make the actual request.

Regular auditing of S3 logs and event notification through SNS can be used to improve the security. Object versioning also will help to mitigate spam issues.

This code is derived from Tommy Back's work.

This program is licensed under The MIT License. See the LICENSE file for the license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPolicy

func NewPolicy(key string, c *Credentials, o *PolicyOptions) *policy

Creates a new policy.

Types

type Credentials

type Credentials struct {
	Region          string
	Bucket          string
	AccessKeyID     string
	SecretAccessKey string
	SecurityToken   string
}

Represents AWS credentials and config.

type PolicyOptions

type PolicyOptions struct {
	ExpiryMinutes int
	MaxFileSize   int
	ContentType   string
}

Represents policy options.

type PresignedPOST

type PresignedPOST struct {
	Key        string `json:"key"`
	Policy     string `json:"policy"`
	Signature  string `json:"signature"`
	Action     string `json:"action"`
	Credential string `json:"credential"`
	Date       string `json:"date"`
}

Represents presigned POST information.

func NewPresignedPOST

func NewPresignedPOST(key string, c *Credentials, o *PolicyOptions) (*PresignedPOST, error)

Creates a new presigned POST.

Jump to

Keyboard shortcuts

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