mirror of
https://github.com/teamhanko/hanko.git
synced 2025-10-27 06:06:54 +08:00
* add tests for webhooks * improve error handling when context does not contain webhook manager * add logging to worker and fix nesting error overwrite * remove enable and disable methods in favor for update method * move data in jwt from subject claim to custom `data` claim * add event in jwt to custom `evt` claim * change webhook trigger to only fire once per hook (was once per subscribed event in hook before) Closes #692
38 lines
607 B
Go
38 lines
607 B
Go
package webhooks
|
|
|
|
import (
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/teamhanko/hanko/backend/config"
|
|
"time"
|
|
)
|
|
|
|
type ConfigHook struct {
|
|
BaseWebhook
|
|
}
|
|
|
|
func NewConfigHook(cfgHook config.Webhook, logger echo.Logger) Webhook {
|
|
return &ConfigHook{
|
|
BaseWebhook{
|
|
Logger: logger,
|
|
Callback: cfgHook.Callback,
|
|
Events: cfgHook.Events,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (ch *ConfigHook) DisableOnExpiryDate(_ time.Time) error {
|
|
return nil
|
|
}
|
|
|
|
func (ch *ConfigHook) DisableOnFailure() error {
|
|
return nil
|
|
}
|
|
|
|
func (ch *ConfigHook) Reset() error {
|
|
return nil
|
|
}
|
|
|
|
func (ch *ConfigHook) IsEnabled() bool {
|
|
return true
|
|
}
|