hook

package
v0.0.0-...-c4f7e29 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderRequestBodySignature = "x-authgear-body-signature"

Variables

View Source
var ContextKeyDenoClient = denoClientContextKeyType{}
View Source
var DenoCheckError = apierrors.Invalid.WithReason("DenoCheckError")
View Source
var DenoFileFilenameRegexp = regexp.MustCompile(`^deno/[.0-9a-zA-Z]+\.ts$`)
View Source
var DenoRunError = apierrors.BadRequest.WithReason("DenoRunError")
View Source
var WebHookDeliveryTimeout = apierrors.InternalError.WithReason("WebHookDeliveryTimeout")
View Source
var WebHookDisallowed = apierrors.Forbidden.WithReason("WebHookDisallowed")
View Source
var WebHookInvalidResponse = apierrors.InternalError.WithReason("WebHookInvalidResponse")

Functions

This section is empty.

Types

type AsyncDenoClient

type AsyncDenoClient interface {
	DenoClient
}

func NewAsyncDenoClient

func NewAsyncDenoClient(endpoint config.DenoEndpoint, logger Logger) AsyncDenoClient

type AsyncHTTPClient

type AsyncHTTPClient struct {
	*http.Client
}

func NewAsyncHTTPClient

func NewAsyncHTTPClient() AsyncHTTPClient

type CheckRequest

type CheckRequest struct {
	Script string `json:"script"`
}

type CheckResponse

type CheckResponse struct {
	Stderr string `json:"stderr,omitempty"`
}

type CustomAttributesServiceNoEvent

type CustomAttributesServiceNoEvent interface {
	UpdateAllCustomAttributes(role accesscontrol.Role, userID string, reprForm map[string]interface{}) error
}

type DenoClient

type DenoClient interface {
	Run(ctx context.Context, script string, input interface{}) (out interface{}, err error)
}

type DenoClientImpl

type DenoClientImpl struct {
	Endpoint   string
	HTTPClient *http.Client
	Logger     Logger
}

func (*DenoClientImpl) Check

func (c *DenoClientImpl) Check(ctx context.Context, snippet string) error

func (*DenoClientImpl) Run

func (c *DenoClientImpl) Run(ctx context.Context, snippet string, input interface{}) (interface{}, error)

type DenoFileDescriptor

type DenoFileDescriptor struct{}

func (DenoFileDescriptor) FindResources

func (d DenoFileDescriptor) FindResources(fs resource.Fs) ([]resource.Location, error)

func (DenoFileDescriptor) MatchResource

func (DenoFileDescriptor) MatchResource(path string) (*resource.Match, bool)

func (DenoFileDescriptor) UpdateResource

func (DenoFileDescriptor) ViewResources

func (DenoFileDescriptor) ViewResources(resources []resource.ResourceFile, rawView resource.View) (interface{}, error)

type DenoHook

type DenoHook struct {
	Context         context.Context
	ResourceManager ResourceManager
}

func (*DenoHook) Run

func (h *DenoHook) Run(client DenoClient, u *url.URL, input interface{}) (out interface{}, err error)

func (*DenoHook) SupportURL

func (h *DenoHook) SupportURL(u *url.URL) bool

type EventDenoHook

type EventDenoHook interface {
	SupportURL(u *url.URL) bool
	DeliverBlockingEvent(u *url.URL, e *event.Event) (*event.HookResponse, error)
	DeliverNonBlockingEvent(u *url.URL, e *event.Event) error
}

type EventDenoHookImpl

type EventDenoHookImpl struct {
	DenoHook
	SyncDenoClient  SyncDenoClient
	AsyncDenoClient AsyncDenoClient
}

func (*EventDenoHookImpl) DeliverBlockingEvent

func (h *EventDenoHookImpl) DeliverBlockingEvent(u *url.URL, e *event.Event) (*event.HookResponse, error)

func (*EventDenoHookImpl) DeliverNonBlockingEvent

func (h *EventDenoHookImpl) DeliverNonBlockingEvent(u *url.URL, e *event.Event) error

type EventWebHook

type EventWebHook interface {
	SupportURL(u *url.URL) bool
	DeliverBlockingEvent(u *url.URL, e *event.Event) (*event.HookResponse, error)
	DeliverNonBlockingEvent(u *url.URL, e *event.Event) error
}

type EventWebHookImpl

type EventWebHookImpl struct {
	WebHookImpl
	SyncHTTP  SyncHTTPClient
	AsyncHTTP AsyncHTTPClient
}

func (*EventWebHookImpl) DeliverBlockingEvent

func (h *EventWebHookImpl) DeliverBlockingEvent(u *url.URL, e *event.Event) (*event.HookResponse, error)

func (*EventWebHookImpl) DeliverNonBlockingEvent

func (h *EventWebHookImpl) DeliverNonBlockingEvent(u *url.URL, e *event.Event) error

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type OperationDisallowedItem

type OperationDisallowedItem struct {
	Title  string `json:"title"`
	Reason string `json:"reason"`
}

type ResourceManager

type ResourceManager interface {
	Read(desc resource.Descriptor, view resource.View) (interface{}, error)
}

type RolesAndGroupsServiceNoEvent

type RolesAndGroupsServiceNoEvent interface {
	ResetUserRole(options *rolesgroups.ResetUserRoleOptions) error
	ResetUserGroup(options *rolesgroups.ResetUserGroupOptions) error
}

type RunRequest

type RunRequest struct {
	Script string      `json:"script"`
	Input  interface{} `json:"input"`
}

type RunResponse

type RunResponse struct {
	Error  string      `json:"error,omitempty"`
	Output interface{} `json:"output,omitempty"`
	Stderr *Stream     `json:"stderr,omitempty"`
	Stdout *Stream     `json:"stdout,omitempty"`
}

type Sink

type Sink struct {
	Logger             Logger
	Config             *config.HookConfig
	Clock              clock.Clock
	EventWebHook       EventWebHook
	EventDenoHook      EventDenoHook
	StandardAttributes StandardAttributesServiceNoEvent
	CustomAttributes   CustomAttributesServiceNoEvent
	RolesAndGroups     RolesAndGroupsServiceNoEvent
}

func (*Sink) DeliverBlockingEvent

func (s *Sink) DeliverBlockingEvent(e *event.Event) error

func (*Sink) DeliverNonBlockingEvent

func (s *Sink) DeliverNonBlockingEvent(e *event.Event) error

func (*Sink) ReceiveBlockingEvent

func (s *Sink) ReceiveBlockingEvent(e *event.Event) (err error)

func (*Sink) ReceiveNonBlockingEvent

func (s *Sink) ReceiveNonBlockingEvent(e *event.Event) (err error)

func (*Sink) WillDeliverBlockingEvent

func (s *Sink) WillDeliverBlockingEvent(eventType event.Type) bool

func (*Sink) WillDeliverNonBlockingEvent

func (s *Sink) WillDeliverNonBlockingEvent(eventType event.Type) bool

type StandardAttributesServiceNoEvent

type StandardAttributesServiceNoEvent interface {
	UpdateStandardAttributes(role accesscontrol.Role, userID string, stdAttrs map[string]interface{}) error
}

type Stream

type Stream struct {
	String    string `json:"string,omitempty"`
	Truncated bool   `json:"truncated,omitempty"`
}

type SyncDenoClient

type SyncDenoClient interface {
	DenoClient
}

func NewSyncDenoClient

func NewSyncDenoClient(endpoint config.DenoEndpoint, c *config.HookConfig, logger Logger) SyncDenoClient

type SyncHTTPClient

type SyncHTTPClient struct {
	*http.Client
}

func NewSyncHTTPClient

func NewSyncHTTPClient(c *config.HookConfig) SyncHTTPClient

type WebHook

type WebHook interface {
	SupportURL(u *url.URL) bool
	PrepareRequest(u *url.URL, body interface{}) (*http.Request, error)
	PerformWithResponse(client *http.Client, request *http.Request) (resp *http.Response, err error)
	PerformNoResponse(client *http.Client, request *http.Request) error
}

type WebHookImpl

type WebHookImpl struct {
	Secret *config.WebhookKeyMaterials
}

func (*WebHookImpl) PerformNoResponse

func (h *WebHookImpl) PerformNoResponse(
	client *http.Client,
	request *http.Request) error

func (*WebHookImpl) PerformWithResponse

func (h *WebHookImpl) PerformWithResponse(
	client *http.Client,
	request *http.Request) (resp *http.Response, err error)

The caller should close the response body if the response is not nil.

func (*WebHookImpl) PrepareRequest

func (h *WebHookImpl) PrepareRequest(u *url.URL, body interface{}) (*http.Request, error)

func (*WebHookImpl) SupportURL

func (h *WebHookImpl) SupportURL(u *url.URL) bool

Jump to

Keyboard shortcuts

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