handlers

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Endpoint

func Endpoint(next EndpointHandler, server ScimServer) http.HandlerFunc

func ErrorCheck

func ErrorCheck(err error)

throw the error out immediately error handlers are supposed to recover it and write appropriate responses

func ParseBodyAsResource

func ParseBodyAsResource(req WebRequest) (*Resource, error)

func ParseIdAndVersion

func ParseIdAndVersion(req WebRequest) (id, version string)

func ParseInclusionAndExclusionAttributes

func ParseInclusionAndExclusionAttributes(req WebRequest) (attributes, excludedAttributes []string)

func ParseModification

func ParseModification(req WebRequest) (Modification, error)

func ParseSearchRequest

func ParseSearchRequest(req WebRequest, server ScimServer) (SearchRequest, error)

Types

type BulkWebRequest

type BulkWebRequest struct {
	// contains filtered or unexported fields
}

bulk web request, implements WebRequest

func (BulkWebRequest) Body

func (bwr BulkWebRequest) Body() ([]byte, error)

func (BulkWebRequest) Header

func (bwr BulkWebRequest) Header(name string) string

func (BulkWebRequest) Method

func (bwr BulkWebRequest) Method() string

func (BulkWebRequest) Param

func (bwr BulkWebRequest) Param(name string) string

func (BulkWebRequest) Populate

func (bwr BulkWebRequest) Populate(op BulkReqOp, ps PropertySource)

func (BulkWebRequest) Target

func (bwr BulkWebRequest) Target() string

type EndpointHandler

type EndpointHandler func(r WebRequest, server ScimServer, ctx context.Context) *ResponseInfo

functional interface for all endpoints to implement

func ErrorRecovery

func ErrorRecovery(next EndpointHandler) EndpointHandler

func InjectRequestScope

func InjectRequestScope(next EndpointHandler, requestType int) EndpointHandler

type ResponseInfo

type ResponseInfo struct {
	// contains filtered or unexported fields
}

response info

func BulkHandler

func BulkHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func CreateGroupHandler

func CreateGroupHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func CreateUserHandler

func CreateUserHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func DeleteGroupByIdHandler

func DeleteGroupByIdHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func DeleteUserByIdHandler

func DeleteUserByIdHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func GetAllResourceTypeHandler

func GetAllResourceTypeHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func GetAllSchemaHandler

func GetAllSchemaHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func GetGroupByIdHandler

func GetGroupByIdHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func GetSchemaByIdHandler

func GetSchemaByIdHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func GetServiceProviderConfigHandler

func GetServiceProviderConfigHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func GetUserByIdHandler

func GetUserByIdHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func PatchGroupHandler

func PatchGroupHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func PatchUserHandler

func PatchUserHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func QueryGroupHandler

func QueryGroupHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func QueryUserHandler

func QueryUserHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func ReplaceGroupHandler

func ReplaceGroupHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func ReplaceUserHandler

func ReplaceUserHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func RootQueryHandler

func RootQueryHandler(r shared.WebRequest, server ScimServer, ctx context.Context) (ri *ResponseInfo)

func (*ResponseInfo) Body

func (ri *ResponseInfo) Body(content []byte) *ResponseInfo

func (*ResponseInfo) ETagHeader

func (ri *ResponseInfo) ETagHeader(version string) *ResponseInfo

func (*ResponseInfo) GetBody

func (ri *ResponseInfo) GetBody() []byte

func (*ResponseInfo) GetHeader

func (ri *ResponseInfo) GetHeader(name string) string

func (*ResponseInfo) GetStatus

func (ri *ResponseInfo) GetStatus() int

func (*ResponseInfo) Header

func (ri *ResponseInfo) Header(k, v string) *ResponseInfo

func (*ResponseInfo) LocationHeader

func (ri *ResponseInfo) LocationHeader(location string) *ResponseInfo

func (*ResponseInfo) ScimJsonHeader

func (ri *ResponseInfo) ScimJsonHeader() *ResponseInfo

func (*ResponseInfo) Status

func (ri *ResponseInfo) Status(statusCode int) *ResponseInfo

type ScimServer

type ScimServer interface {
	// utilities
	Property() PropertySource
	Logger() Logger
	WebRequest(r *http.Request) WebRequest

	// schema
	Schema(id string) *Schema
	InternalSchema(id string) *Schema

	// case
	CorrectCase(subj *Resource, sch *Schema, ctx context.Context) error

	// patch
	ApplyPatch(patch Patch, subj *Resource, sch *Schema, ctx context.Context) error

	// validation
	ValidateType(subj *Resource, sch *Schema, ctx context.Context) error
	ValidateRequired(subj *Resource, sch *Schema, ctx context.Context) error
	ValidateMutability(subj *Resource, ref *Resource, sch *Schema, ctx context.Context) error
	ValidateUniqueness(subj *Resource, sch *Schema, repo Repository, ctx context.Context) error

	// read only generation
	AssignReadOnlyValue(r *Resource, ctx context.Context) error

	// json
	MarshalJSON(v interface{}, sch *Schema, attributes []string, excludedAttributes []string) ([]byte, error)

	// repo
	Repository(identifier string) Repository
}

interface for server, provides all necessary components for processing

Jump to

Keyboard shortcuts

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