Documentation ¶
Index ¶
- Constants
- Variables
- type BlockingPayload
- type Context
- type CustomAttributesServiceNoEvent
- type Event
- type HookResponse
- type JWTMutations
- type Mutations
- type MutationsEffectContext
- type NonBlockingPayload
- type OAuthContext
- type Payload
- type RolesAndGroupsServiceNoEvent
- type StandardAttributesServiceNoEvent
- type TriggeredByType
- type Type
- type UserMutations
Constants ¶
View Source
const ContextSchema = `` /* 141-byte string literal not displayed */
@JSONSchema
Variables ¶
View Source
var HookResponseSchema = validation.NewSimpleSchema(`
{
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"is_allowed": { "const": true },
"mutations": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"standard_attributes": {
"type": "object"
},
"custom_attributes": {
"type": "object"
}
}
},
"jwt": {
"type": "object",
"properties": {
"payload": {
"type": "object"
}
}
}
}
}
},
"required": ["is_allowed"]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"is_allowed": { "const": false },
"title": { "type": "string" },
"reason": { "type": "string" }
},
"required": ["is_allowed"]
}
]
}
`)
Functions ¶
This section is empty.
Types ¶
type BlockingPayload ¶
type BlockingPayload interface { Payload BlockingEventType() Type // ApplyMutations applies mutations to itself. ApplyMutations(ctx context.Context, mutations Mutations) bool // PerformEffects performs the side effects of the mutations. PerformEffects(ctx context.Context, effectCtx MutationsEffectContext) error }
type Context ¶
type Context struct { Timestamp int64 `json:"timestamp"` UserID *string `json:"user_id"` TriggeredBy TriggeredByType `json:"triggered_by"` AuditContext interface{} `json:"audit_context"` PreferredLanguages []string `json:"preferred_languages"` Language string `json:"language"` OAuth *OAuthContext `json:"oauth,omitempty"` IPAddress string `json:"ip_address,omitempty"` UserAgent string `json:"user_agent,omitempty"` AppID string `json:"app_id,omitempty"` ClientID string `json:"client_id,omitempty"` }
type Event ¶
type Event struct { ID string `json:"id"` Seq int64 `json:"seq"` Type Type `json:"type"` Payload Payload `json:"payload"` Context Context `json:"context"` IsNonBlocking bool `json:"-"` }
func (*Event) ApplyMutations ¶
func (*Event) PerformEffects ¶
func (e *Event) PerformEffects(ctx context.Context, effectCtx MutationsEffectContext) error
type HookResponse ¶
type HookResponse struct { IsAllowed bool `json:"is_allowed"` Title string `json:"title,omitempty"` Reason string `json:"reason,omitempty"` Mutations Mutations `json:"mutations,omitempty"` }
func ParseHookResponse ¶
func ParseHookResponse(r io.Reader) (*HookResponse, error)
type JWTMutations ¶
type JWTMutations struct {
Payload map[string]interface{} `json:"payload,omitempty"`
}
type Mutations ¶
type Mutations struct { User UserMutations `json:"user,omitempty"` JWT JWTMutations `json:"jwt,omitempty"` }
type MutationsEffectContext ¶
type MutationsEffectContext struct { StandardAttributes StandardAttributesServiceNoEvent CustomAttributes CustomAttributesServiceNoEvent RolesAndGroups RolesAndGroupsServiceNoEvent }
type NonBlockingPayload ¶
type OAuthContext ¶
type Payload ¶
type Payload interface { UserID() string GetTriggeredBy() TriggeredByType FillContext(ctx *Context) }
type RolesAndGroupsServiceNoEvent ¶
type RolesAndGroupsServiceNoEvent interface { ResetUserRole(ctx context.Context, options *rolesgroups.ResetUserRoleOptions) error ResetUserGroup(ctx context.Context, options *rolesgroups.ResetUserGroupOptions) error }
type TriggeredByType ¶
type TriggeredByType string
const ( // TriggeredByTypeUser means the event originates from a end-user facing UI. TriggeredByTypeUser TriggeredByType = "user" // TriggeredByTypeAdminAPI means the event originates from the Admin API. TriggeredByTypeAdminAPI TriggeredByType = "admin_api" // TriggeredBySystem means the event originates from a background job. TriggeredBySystem TriggeredByType = "system" // TriggeredByPortal means the event originates from the management portal. TriggeredByPortal TriggeredByType = "portal" )
Click to show internal directories.
Click to hide internal directories.