security

package
v0.0.0-...-6e2473b Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	Authorize(userID string, roles []string, request Request) (bool, error)
}

Authorizer interface used to decide if a user has access to a specific resource.

type Request

Request is of type APIGatewayProxyRequest since we're leveraging the AWS Lambda Proxy Request functionality (default behavior)

https://serverless.com/framework/docs/providers/aws/events/apigateway/#lambda-proxy-integration

type RequestHandler

type RequestHandler func(request Request) (Response, error)

RequestHandler is called to handle an incoming HTTP request.

func NewAdminAuthorizationHandler

func NewAdminAuthorizationHandler(handler SecuredRequestHandler) RequestHandler

NewAdminAuthorizationHandler only allow admin users to access.

func NewAuthorizationByRolesHandler

func NewAuthorizationByRolesHandler(handler SecuredRequestHandler, roles []string) RequestHandler

NewAuthorizationByRolesHandler only allow admin users to access.

func NewAuthorizationHandler

func NewAuthorizationHandler(handler SecuredRequestHandler, authorizer Authorizer) RequestHandler

NewAuthorizationHandler checks if the user from our token has access to the resource at hand via a custom authorizer.

type Response

Response is of type APIGatewayProxyResponse since we're leveraging the AWS Lambda Proxy Request functionality (default behavior)

https://serverless.com/framework/docs/providers/aws/events/apigateway/#lambda-proxy-integration

type SecuredRequestHandler

type SecuredRequestHandler func(request Request, userID string, roles []string) (Response, error)

SecuredRequestHandler is called by the security checker to handle an incoming HTTP request.

Jump to

Keyboard shortcuts

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