Documentation
¶
Index ¶
- Constants
- Variables
- 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 Event
- type Events
- type HMAC
- 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") )
View Source
var (
ErrMissingFieldID = fmt.Errorf("missing id field in event")
)
View Source
var (
ErrWebhookPathRequired = errors.New("webhook path is required")
)
Functions ¶
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 ¶
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 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 ValidatingRequest ¶
Click to show internal directories.
Click to hide internal directories.