middleware

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsurePeriod

func EnsurePeriod(start time.Time, end time.Time) error

func FilterDeletedEndpoints

func FilterDeletedEndpoints(endpoints []datastore.Endpoint) []datastore.Endpoint

func GetApplicationEndpointFromContext

func GetApplicationEndpointFromContext(ctx context.Context) *datastore.Endpoint

func GetApplicationFromContext

func GetApplicationFromContext(ctx context.Context) *datastore.Application

func GetApplicationsFromContext

func GetApplicationsFromContext(ctx context.Context) *[]datastore.Application

func GetAuthFromRequest

func GetAuthFromRequest(r *http.Request) (*auth.Credential, error)

func GetAuthUserFromContext

func GetAuthUserFromContext(ctx context.Context) *auth.AuthenticatedUser

func GetDeliveryAttemptFromContext

func GetDeliveryAttemptFromContext(ctx context.Context) *datastore.DeliveryAttempt

func GetDeliveryAttemptsFromContext

func GetDeliveryAttemptsFromContext(ctx context.Context) *[]datastore.DeliveryAttempt

func GetEventDeliveryFromContext

func GetEventDeliveryFromContext(ctx context.Context) *datastore.EventDelivery

func GetEventFromContext

func GetEventFromContext(ctx context.Context) *datastore.Event

func GetGroupFromContext

func GetGroupFromContext(ctx context.Context) *datastore.Group

func GetHostFromContext

func GetHostFromContext(ctx context.Context) string

func GetOrganisationFromContext

func GetOrganisationFromContext(ctx context.Context) *datastore.Organisation

func GetOrganisationMemberFromContext

func GetOrganisationMemberFromContext(ctx context.Context) *datastore.OrganisationMember

func GetPageableFromContext

func GetPageableFromContext(ctx context.Context) datastore.Pageable

func GetPaginationDataFromContext

func GetPaginationDataFromContext(ctx context.Context) *datastore.PaginationData

func GetUserFromContext

func GetUserFromContext(ctx context.Context) *datastore.User

func ParseEndpointFromBody

func ParseEndpointFromBody(r *http.Request) (models.Endpoint, error)

func SetDeliveryAttemptsInContext

func SetDeliveryAttemptsInContext(ctx context.Context,
	attempts *[]datastore.DeliveryAttempt) context.Context

func ShouldAuthRoute

func ShouldAuthRoute(r *http.Request) bool

Types

type AuthorizedLogin

type AuthorizedLogin struct {
	Username   string    `json:"username,omitempty"`
	Token      string    `json:"token"`
	ExpiryTime time.Time `json:"expiry_time"`
}

func GetAuthLoginFromContext

func GetAuthLoginFromContext(ctx context.Context) *AuthorizedLogin

type Middleware

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

func NewMiddleware

func NewMiddleware(cs *CreateMiddleware) *Middleware

func (*Middleware) ComputeDashboardMessages

func (m *Middleware) ComputeDashboardMessages(ctx context.Context, orgId string, searchParams datastore.SearchParams, period datastore.Period) (uint64, []datastore.EventInterval, error)

func (*Middleware) GetDefaultGroup

func (m *Middleware) GetDefaultGroup(r *http.Request, groupRepo datastore.GroupRepository) (*datastore.Group, error)

func (*Middleware) InstrumentPath

func (m *Middleware) InstrumentPath(path string) func(http.Handler) http.Handler

func (*Middleware) InstrumentRequests

func (m *Middleware) InstrumentRequests() func(next http.Handler) http.Handler

func (*Middleware) JsonResponse

func (m *Middleware) JsonResponse(next http.Handler) http.Handler

func (*Middleware) LogHttpRequest

func (m *Middleware) LogHttpRequest() func(next http.Handler) http.Handler

func (*Middleware) Pagination

func (m *Middleware) Pagination(next http.Handler) http.Handler

func (*Middleware) RateLimitByGroupID

func (m *Middleware) RateLimitByGroupID() func(next http.Handler) http.Handler

func (*Middleware) RateLimitByGroupWithParams

func (m *Middleware) RateLimitByGroupWithParams(requestLimit int, windowLength time.Duration) func(next http.Handler) http.Handler

func (*Middleware) RequireApp

func (m *Middleware) RequireApp() func(next http.Handler) http.Handler

func (*Middleware) RequireAppEndpoint

func (m *Middleware) RequireAppEndpoint() func(next http.Handler) http.Handler

func (*Middleware) RequireAppID

func (m *Middleware) RequireAppID() func(next http.Handler) http.Handler

func (*Middleware) RequireAppPortalApplication

func (m *Middleware) RequireAppPortalApplication() func(next http.Handler) http.Handler

func (*Middleware) RequireAppPortalPermission

func (m *Middleware) RequireAppPortalPermission(role auth.RoleType) func(next http.Handler) http.Handler

func (*Middleware) RequireAuth

func (m *Middleware) RequireAuth() func(next http.Handler) http.Handler

func (*Middleware) RequireAuthUserMetadata

func (m *Middleware) RequireAuthUserMetadata() func(next http.Handler) http.Handler

func (*Middleware) RequireAuthorizedUser

func (m *Middleware) RequireAuthorizedUser() func(next http.Handler) http.Handler

func (*Middleware) RequireBaseUrl

func (m *Middleware) RequireBaseUrl() func(next http.Handler) http.Handler

func (*Middleware) RequireDeliveryAttempt

func (m *Middleware) RequireDeliveryAttempt() func(next http.Handler) http.Handler

func (*Middleware) RequireEvent

func (m *Middleware) RequireEvent() func(next http.Handler) http.Handler

func (*Middleware) RequireEventDelivery

func (m *Middleware) RequireEventDelivery() func(next http.Handler) http.Handler

func (*Middleware) RequireGroup

func (m *Middleware) RequireGroup() func(next http.Handler) http.Handler

func (*Middleware) RequireOrganisation

func (m *Middleware) RequireOrganisation() func(next http.Handler) http.Handler

func (*Middleware) RequireOrganisationGroupMember

func (m *Middleware) RequireOrganisationGroupMember() func(next http.Handler) http.Handler

func (*Middleware) RequireOrganisationMemberRole

func (m *Middleware) RequireOrganisationMemberRole(roleType auth.RoleType) func(next http.Handler) http.Handler

func (*Middleware) RequireOrganisationMembership

func (m *Middleware) RequireOrganisationMembership() func(next http.Handler) http.Handler

func (*Middleware) RequirePermission

func (m *Middleware) RequirePermission(role auth.RoleType) func(next http.Handler) http.Handler

func (*Middleware) SetupCORS

func (m *Middleware) SetupCORS(next http.Handler) http.Handler

func (*Middleware) WriteRequestIDHeader

func (m *Middleware) WriteRequestIDHeader(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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