Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultAuthTokenExpiration = 2 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func ApiImpersonateStart ¶
func ApiImpersonateStart(w http.ResponseWriter, r *http.Request, deps Dependencies)
func ApiImpersonateStartWithAuth ¶
func ApiImpersonateStartWithAuth(w http.ResponseWriter, r *http.Request, a types.AuthSharedInterface)
Types ¶
type Dependencies ¶
type Dependencies struct {
CanImpersonate func(ctx context.Context, adminUserID string, targetUserID string) (bool, error)
UserFindByAuthToken func(ctx context.Context, token string, options types.UserAuthOptions) (string, error)
UserStoreAuthToken func(ctx context.Context, token string, userID string, options types.UserAuthOptions) error
TemporaryKeyGet func(key string) (string, error)
TemporaryKeySet func(key string, value string, expiresSeconds int) error
UseCookies bool
CookieName string
SetAuthCookie func(w http.ResponseWriter, r *http.Request, token string)
ObservabilityHooks types.ObservabilityHooks
ImpersonationStart func(ctx context.Context, adminUserID string, targetUserID string) error
// Logger is used to log internal errors. If nil, slog.Default() is used.
Logger *slog.Logger
}
Click to show internal directories.
Click to hide internal directories.