authlab

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package authlab provides a self-hosted mini web app used to exercise Katana recorded-flow / auto-login authentication end-to-end.

It exposes three login styles against the same cookie-gated app surface:

  1. Classic HTML form POST (/login)
  2. Username-first multi-step (/login/step) — email → next → password
  3. JS SPA login (/login/spa) — client-side panels + fetch

Authenticated pages under /app/* require the session cookie set by a successful login. Tests assert that a recorded flow can unlock those pages for a subsequent crawl.

Index

Constants

View Source
const (
	// Username / Password are the only credentials the lab accepts.
	Username = "tester@katana.test"
	Password = "katana-rocks"

	CookieName  = "katana_session"
	CookieValue = "authenticated"
	CSRFCookie  = "katana_csrf"

	// SecretMarker appears only on the cookie-gated /app/secret page.
	SecretMarker = "KATANA_AUTH_SECRET_OK"
)

Variables

This section is empty.

Functions

func ChromeRecordingSPA

func ChromeRecordingSPA(baseURL string) string

ChromeRecordingSPA returns a Recorder export for the SPA fetch login.

func ChromeRecordingSimple

func ChromeRecordingSimple(baseURL string) string

ChromeRecordingSimple returns a Chrome DevTools Recorder export for the classic /login form.

func ChromeRecordingStep

func ChromeRecordingStep(baseURL string) string

ChromeRecordingStep returns a Recorder export for the username-first flow.

func ExplicitStepsSimple

func ExplicitStepsSimple(baseURL string) string

ExplicitStepsSimple is a hand-authored step list for the classic login.

Types

type Lab

type Lab struct {
	URL string

	LoginPosts    atomic.Int64
	SecretHits    atomic.Int64
	DashboardHits atomic.Int64
	LogoutHits    atomic.Int64
	// contains filtered or unexported fields
}

Lab is a running local auth testbed.

func Start

func Start() (*Lab, error)

Start launches the lab on 127.0.0.1 with an ephemeral port.

func (*Lab) Close

func (l *Lab) Close() error

Close shuts the lab down.

Jump to

Keyboard shortcuts

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