Documentation
¶
Index ¶
- Constants
- func AccountAuthMiddleware(jwtSigner *jwt.Signer) mux.MiddlewareFunc
- 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
- type ImpersonationInfo
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 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
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)
Click to show internal directories.
Click to hide internal directories.