middleware

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const AccountContextKey contextKey = "account"
View Source
const AccountNotFoundError string = "account_not_found_error"
View Source
const EffectiveAccountContextKey contextKey = "effective_account"
View Source
const ImpersonationContextKey contextKey = "impersonation"
View Source
const OrganizationNotFoundError string = "organization_not_found_error"
View Source
const ScopedTokenClaimsContextKey contextKey = "scopedTokenClaims"
View Source
const UserContextKey contextKey = "user"

Variables

This section is empty.

Functions

func AccountAuthMiddleware

func AccountAuthMiddleware(jwtSigner *jwt.Signer) mux.MiddlewareFunc

func GetAccountFromContext

func GetAccountFromContext(ctx context.Context) (*models.Account, bool)

func GetEffectiveAccountFromContext added in v0.14.0

func GetEffectiveAccountFromContext(ctx context.Context) (*models.Account, bool)

GetEffectiveAccountFromContext returns the impersonated account when an impersonation session is active, otherwise the real account. Use this in handlers that should reflect the impersonated user's data.

func GetScopedTokenClaimsFromContext added in v0.14.0

func GetScopedTokenClaimsFromContext(ctx context.Context) (*jwt.ScopedTokenClaims, bool)

func GetUserFromContext

func GetUserFromContext(ctx context.Context) (*models.User, bool)

func IsOwnerSetupRequired

func IsOwnerSetupRequired() bool

func LoggingMiddleware

func LoggingMiddleware(logger *log.Logger) mux.MiddlewareFunc

func MarkOwnerSetupCompleted

func MarkOwnerSetupCompleted()

func OrganizationAuthMiddleware

func OrganizationAuthMiddleware(jwtSigner *jwt.Signer) mux.MiddlewareFunc

func OwnerSetupEnabled

func OwnerSetupEnabled() bool

func RequireInstallationAdmin added in v0.14.0

func RequireInstallationAdmin() mux.MiddlewareFunc

RequireInstallationAdmin is a middleware that ensures the request is from an authenticated installation admin. Non-admin requests receive a 404 to avoid leaking the existence of admin endpoints.

func ResetOwnerSetupStateForTests

func ResetOwnerSetupStateForTests()

func ShowFullLogs

func ShowFullLogs() bool

Types

type ImpersonationInfo added in v0.14.0

type ImpersonationInfo struct {
	AdminAccountID string
	Active         bool
	UserName       string
}

ImpersonationInfo is stored in the request context when an admin is impersonating another user.

func GetImpersonationFromContext added in v0.14.0

func GetImpersonationFromContext(ctx context.Context) (*ImpersonationInfo, bool)

Jump to

Keyboard shortcuts

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