aws

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 10 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPrincipal

func ExtractPrincipal(request events.APIGatewayProxyRequest) (goauth.Principal, error)

func NewContextAppendingTransport

func NewContextAppendingTransport(ctx context.Context, toWrap http.RoundTripper) http.RoundTripper

Types

type AllowedEndpoint

type AllowedEndpoint struct {
	Method string
	Path   string
}

Allowed Endpoint represents a resource a principal is allowed to access. Used in building policy documents, * globs are supported.

type Authorizer

type Authorizer interface {
	Authenticate(ctx context.Context, token string) (goauth.Principal, error)
}

type AuthorizerCallback

type AuthorizerCallback interface {
	AuthFailed() error
	AuthPass(p goauth.Principal) error
	ErrorEncountered(err error)
}

type AuthorizerLambdaConfig

type AuthorizerLambdaConfig struct {
	AllowAnonymous  bool
	Authorizer      Authorizer
	CallbackFactory func(ctx context.Context) AuthorizerCallback
	PolicyBuilder   PolicyBuilder
}

type EndpointMapper

type EndpointMapper interface {
	AllowedEndpoints(ctx context.Context, principal goauth.Principal) ([]AllowedEndpoint, error)
}

EndpointMapper takes a principle and returns the endpoints they are allowed to access

type GatewayPolicyBuilder

type GatewayPolicyBuilder struct {
	Region    string
	AccountID string
	ApiID     string
	Stage     string
	// contains filtered or unexported fields
}

GatewayPolicyBuilder builds policy documents that can be used with custom authorizer lambda's

func NewGatewayPolicyBuilder

func NewGatewayPolicyBuilder(region, accountID, apiID, stage string, endpointMapper EndpointMapper) *GatewayPolicyBuilder

func (*GatewayPolicyBuilder) BuildPolicy

type HTTPClientFactory

type HTTPClientFactory func(ctx context.Context) *http.Client

func NewXRAYAwareHTTPClientFactory

func NewXRAYAwareHTTPClientFactory(baseClient *http.Client) HTTPClientFactory

func (HTTPClientFactory) HTTPClient

func (h HTTPClientFactory) HTTPClient(ctx context.Context) *http.Client

type PolicyBuilder

type PolicyBuilder interface {
	BuildPolicy(ctx context.Context, principal goauth.Principal) (events.APIGatewayCustomAuthorizerPolicy, error)
}

Jump to

Keyboard shortcuts

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