Documentation
¶
Index ¶
- Constants
- Variables
- func GetEventTypeByPath(path string) func(data EventTypeParam) string
- func GetHeaderValues(req ValidatingRequest, headerName, secret string) ([]string, error)
- func GetPrimaryKeyByPath(path string) func(parsedData gjson.Result) entities.PkFields
- func SetupService(ctx context.Context, router *swagger.Router[fiber.Handler, fiber.Router], ...) error
- type Authentication
- type Configuration
- type ContentTypeConfig
- type Event
- type EventTypeParam
- type Events
- type HMAC
- type RequestInfo
- type ValidatingRequest
Constants ¶
View Source
const ( InvalidWebhookAuthenticationConfig = "invalid webhook authentication configuration" SignatureHeaderButNoSecretError = "secret not configured for validating webhook signature" NoSignatureHeaderButSecretError = "missing webhook signature" MultipleSignatureHeadersError = "multiple signature headers found" InvalidSignatureError = "invalid signature in request" )
Variables ¶
View Source
var ( ErrUnmarshalEvent = errors.New("error unmarshaling event") ErrUnsupportedWebhookEvent = errors.New("unsupported webhook event") ErrUnsupportedContentType = errors.New("unsupported content type for webhook request") ErrFailedToParseContentType = errors.New("failed to parse content type") ErrFailsToParseBody = errors.New("failed to parse body") )
View Source
var (
ErrMissingFieldID = fmt.Errorf("missing id field in event")
)
View Source
var (
ErrWebhookPathRequired = errors.New("webhook path is required")
)
Functions ¶
func GetEventTypeByPath ¶ added in v0.3.0
func GetEventTypeByPath(path string) func(data EventTypeParam) string
func GetHeaderValues ¶ added in v0.2.0
func GetHeaderValues(req ValidatingRequest, headerName, secret string) ([]string, error)
func GetPrimaryKeyByPath ¶ added in v0.2.0
func SetupService ¶
func SetupService( ctx context.Context, router *swagger.Router[fiber.Handler, fiber.Router], config *Configuration, p pipeline.IPipelineGroup, ) error
Types ¶
type Authentication ¶
type Authentication interface {
CheckSignature(req ValidatingRequest) error
}
type Configuration ¶
type Configuration struct {
// Secret the webhook secret configuration for validating the data received
Authentication Authentication `json:"authentication"`
WebhookPath string `json:"webhookPath"`
Events *Events `json:"events,omitempty"`
}
Configuration is the representation of the configuration for a Jira Cloud webhook
func (*Configuration) CheckSignature ¶ added in v0.2.0
func (c *Configuration) CheckSignature(req ValidatingRequest) error
func (*Configuration) Validate ¶
func (c *Configuration) Validate() error
type ContentTypeConfig ¶ added in v0.3.0
ContentTypeConfig allows configuring how to extract the payload field for a given content-type
type EventTypeParam ¶ added in v0.3.0
type Events ¶
type Events struct {
Supported map[string]Event
GetEventType func(data EventTypeParam) string
PayloadKey ContentTypeConfig
}
type HMAC ¶ added in v0.2.0
type HMAC struct {
Secret config.SecretSource `json:"secret"`
HeaderName string `json:"headerName"`
}
func (HMAC) CheckSignature ¶ added in v0.2.0
func (h HMAC) CheckSignature(req ValidatingRequest) error
CheckSignature will read the webhook signature header and the given secret for validating the webhook payload. It will fail if there is a mismatch in the signatures and if a signature or a secret is provided and the other is not present.
type RequestInfo ¶ added in v0.3.0
type RequestInfo struct {
// contains filtered or unexported fields
}
type ValidatingRequest ¶
Click to show internal directories.
Click to hide internal directories.