auth

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package auth owns the console's platform-authentication client contract.

Package auth owns the UI's platform authentication client and principal contract. Callers inject the HTTP client; session storage and browser-facing handlers remain separate from upstream credential verification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstAPIKey

func FirstAPIKey(apiKeys string) string

func ParseAPIKeyList

func ParseAPIKeyList(s string) []string

parseAPIKeyList splits a comma-separated API-key list into a slice of trimmed, non-empty entries, suitable for use as a per-process lookup.

Types

type AttemptConfig

type AttemptConfig struct {
	Capacity         int
	Refill           time.Duration
	FailureWindow    time.Duration
	FailureThreshold int
	LockoutDuration  time.Duration
}

AttemptConfig is resolved by bootstrap and shared by one login limiter.

func DefaultAttemptConfig

func DefaultAttemptConfig() AttemptConfig

type AttemptTracker

type AttemptTracker struct {
	// contains filtered or unexported fields
}

func NewAttemptTracker

func NewAttemptTracker(now func() time.Time, config AttemptConfig) *AttemptTracker

func (*AttemptTracker) Allow

func (t *AttemptTracker) Allow(clientID string) bool

func (*AttemptTracker) RecordFailure

func (t *AttemptTracker) RecordFailure(clientID string) int

func (*AttemptTracker) RecordSuccess

func (t *AttemptTracker) RecordSuccess(clientID string) int

type Client

type Client struct{ HTTP *http.Client }

Client uses the transport selected by the console bootstrap. All calls retain their bounded contexts and platform authentication/expiry semantics.

func (Client) OIDC

func (c Client) OIDC(ctx context.Context, apiUpstream, idToken string) (Principal, string, time.Time, error)

func (Client) Password

func (c Client) Password(ctx context.Context, apiUpstream, email, password string) (Principal, string, time.Time, error)

func (Client) Session

func (c Client) Session(ctx context.Context, apiUpstream, idToken string) (Principal, string, time.Time, error)

func (Client) VerifyOIDC

func (c Client) VerifyOIDC(ctx context.Context, apiUpstream, idToken string) (Principal, error)

type Hooks

type Hooks struct {
	Password func(context.Context, string, string, string) (Principal, string, time.Time, error)
	OIDC     func(context.Context, string, string) (Principal, string, time.Time, error)
}

Hooks override credential verification for injected integrations; normal requests use Client. They never replace store issuance or login throttling.

type Principal

type Principal = session.Principal

type Server

type Server struct {
	Store             *session.Store
	Client            Client
	Attempts          *AttemptTracker
	Hooks             *Hooks
	ForceSecureCookie bool
	PublicRoutes      topology.Routes
}

Server owns browser authentication, throttling and session-cookie responses. Bootstrap provides its store, upstream client, limiter and cookie policy.

func (*Server) AdminCheck

func (s *Server) AdminCheck(apiKeys, adminAPIKeys []string, legacyAdminKeys bool) http.HandlerFunc

AdminCheck is the Traefik forwardAuth target for Grafana. Admin sessions and keys pass; denied browser page navigations go through platform sign-in. API requests retain their JSON 401 response. Cache-Control is set by the security headers middleware for /auth/.

func (*Server) Login

func (s *Server) Login(apiKey, upstreamAPIKey, apiUpstream string) http.HandlerFunc

func (*Server) Logout

func (s *Server) Logout() http.HandlerFunc

func (*Server) Status

func (s *Server) Status() http.HandlerFunc

Jump to

Keyboard shortcuts

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