common

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JWTIssuer         = "DPHOTO_JWT_ISSUER"
	JWTKeyB64         = "DPHOTO_JWT_KEY_B64"
	JWTValidity       = "DPHOTO_JWT_VALIDITY"
	DynamoDBTableName = "CATALOG_TABLE_NAME"
)

Variables

This section is empty.

Functions

func AccessTokenDecoder

func AccessTokenDecoder() *aclcore.AccessTokenDecoder

func BootstrapArchiveDomain

func BootstrapArchiveDomain() archive.AsyncJobAdapter

func BootstrapCatalogAndArchiveDomains

func BootstrapCatalogAndArchiveDomains() archive.AsyncJobAdapter

BootstrapCatalogAndArchiveDomains bootstraps all domains

func BootstrapCatalogDomain

func BootstrapCatalogDomain()

BootstrapCatalogDomain bootstraps both oauth and catalog

func BootstrapOAuthDomain

func BootstrapOAuthDomain()

BootstrapOAuthDomain only bootstraps oauth

func NewSSOAuthenticator

func NewSSOAuthenticator() *aclcore.SSOAuthenticator

Types

type ArgParser

type ArgParser struct {
	// contains filtered or unexported fields
}

ArgParser is a helper to read several parameters from the request

func NewArgParser

func NewArgParser(request *events.APIGatewayProxyRequest) *ArgParser

func (*ArgParser) BadRequest

func (a *ArgParser) BadRequest() (Response, error)

func (*ArgParser) HasViolations

func (a *ArgParser) HasViolations() bool

func (*ArgParser) ReadPathParameterInt

func (a *ArgParser) ReadPathParameterInt(key string) int

func (*ArgParser) ReadPathParameterString

func (a *ArgParser) ReadPathParameterString(key string) string

func (*ArgParser) ReadQueryParameterBool

func (a *ArgParser) ReadQueryParameterBool(key string, mandatory bool) bool

func (*ArgParser) ReadQueryParameterInt

func (a *ArgParser) ReadQueryParameterInt(key string, mandatory bool) int

type Response

func BadRequest

func BadRequest(body interface{}) (Response, error)

func ForbiddenResponse

func ForbiddenResponse(message string) (Response, error)

func InternalError

func InternalError(cause error) (Response, error)

InternalError logs the error and create a 500 error response

func NewJsonResponse

func NewJsonResponse(code int, body interface{}, headers map[string]string) (Response, error)

NewJsonResponse serialises body into JSON and create a Response containing it as body.

func NotFound

func NotFound(body interface{}) (Response, error)

func Ok

func Ok(body interface{}) (Response, error)

func RequiresCatalogACL

func RequiresCatalogACL(request *events.APIGatewayProxyRequest, process func(claims aclcore.Claims, rules catalogacl.CatalogRules) (Response, error)) (Response, error)

RequiresCatalogACL parses the token and instantiate the ACL extension for 'catalog' domain

accesscontrol.AccessUnauthorisedError errors will be converted into 401 responses accesscontrol.AccessForbiddenError errors will be converted into 403 responses any other errors will be converted into 500

func RequiresCatalogView

func RequiresCatalogView(request *events.APIGatewayProxyRequest, process func(catalogView *catalogaclview.View) (Response, error)) (Response, error)

RequiresCatalogView is based on RequiresCatalogACL but creates a convenient Catalog View

func UnauthorizedResponse

func UnauthorizedResponse(message string) (Response, error)

Jump to

Keyboard shortcuts

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