Documentation
¶
Index ¶
- Constants
- func AccountAuthMiddleware(jwtSigner *jwt.Signer) mux.MiddlewareFunc
- func CriticalHTTPTraceMiddleware(resolveRoute criticalHTTPRouteResolver) func(http.Handler) http.Handler
- func GatewayForwardResponseTraceOption() func(context.Context, http.ResponseWriter, proto.Message) error
- func GetAccountFromContext(ctx context.Context) (*models.Account, bool)
- func GetEffectiveAccountFromContext(ctx context.Context) (*models.Account, bool)
- func GetScopedTokenClaimsFromContext(ctx context.Context) (*jwt.ScopedTokenClaims, bool)
- func GetUserFromContext(ctx context.Context) (*models.User, bool)
- func IsOwnerSetupRequired() bool
- func LoggingMiddleware(logger *log.Logger) mux.MiddlewareFunc
- func MarkOwnerSetupCompleted()
- func OrganizationAuthMiddleware(jwtSigner *jwt.Signer) mux.MiddlewareFunc
- func OwnerSetupEnabled() bool
- func RequireInstallationAdmin() mux.MiddlewareFunc
- func ResetOwnerSetupStateForTests()
- func ShowFullLogs() bool
- func TraceGatewayServe(ctx context.Context, w http.ResponseWriter, gateway http.Handler, ...)
- type ImpersonationInfo
Constants ¶
const AccountContextKey contextKey = "account"
const AccountNotFoundError string = "account_not_found_error"
const EffectiveAccountContextKey contextKey = "effective_account"
const ImpersonationContextKey contextKey = "impersonation"
const OrganizationNotFoundError string = "organization_not_found_error"
const ScopedTokenClaimsContextKey contextKey = "scopedTokenClaims"
const UserContextKey contextKey = "user"
Variables ¶
This section is empty.
Functions ¶
func AccountAuthMiddleware ¶
func AccountAuthMiddleware(jwtSigner *jwt.Signer) mux.MiddlewareFunc
func CriticalHTTPTraceMiddleware ¶ added in v0.26.0
func CriticalHTTPTraceMiddleware(resolveRoute criticalHTTPRouteResolver) func(http.Handler) http.Handler
* CriticalHTTPTraceMiddleware starts a server span before the handler runs so * trace context propagates into grpc-gateway and the internal gRPC server. * Only allowlisted routes are traced.
func GatewayForwardResponseTraceOption ¶ added in v0.26.0
func GatewayForwardResponseTraceOption() func(context.Context, http.ResponseWriter, proto.Message) error
* GatewayForwardResponseTraceOption starts a marshal span before grpc-gateway * encodes the proto response to JSON. The span ends on the first response write.
func GetAccountFromContext ¶
func GetEffectiveAccountFromContext ¶ added in v0.14.0
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 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
func TraceGatewayServe ¶ added in v0.26.0
func TraceGatewayServe(ctx context.Context, w http.ResponseWriter, gateway http.Handler, r *http.Request)
* TraceGatewayServe wraps grpc-gateway handling so the encode/write tail after * the gRPC round trip is visible separately from the otelgrpc client span. * Only allowlisted routes are traced, matching CriticalHTTPTraceMiddleware.
Types ¶
type ImpersonationInfo ¶ added in v0.14.0
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)