console

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeBasePath

func NormalizeBasePath(p string) string

NormalizeBasePath makes a base-path flag value safe to concatenate: no trailing slash (else cookie paths become /console//) and a guaranteed leading slash.

Types

type Config

type Config struct {
	ControlPlaneURL string
	AdminToken      string
	StaticDir       string
	BasePath        string

	// ExternalURL is the origin browsers reach this console on, e.g.
	// "https://console.example". When set it decides the OIDC redirect_uri and
	// whether session cookies are marked Secure, instead of the Host and
	// X-Forwarded-Proto headers, which a client controls and a proxy may drop.
	ExternalURL string
}

type Server

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

func NewServer

func NewServer(cfg Config) (*Server, error)

func (*Server) HandleCallback

func (s *Server) HandleCallback(w http.ResponseWriter, r *http.Request)

func (*Server) HandleInfo

func (s *Server) HandleInfo(w http.ResponseWriter, r *http.Request)

func (*Server) HandleLogin

func (s *Server) HandleLogin(w http.ResponseWriter, r *http.Request)

func (*Server) HandleLogout

func (s *Server) HandleLogout(w http.ResponseWriter, r *http.Request)

func (*Server) HandleSession

func (s *Server) HandleSession(w http.ResponseWriter, r *http.Request)

HandleSession reports whether a session cookie is present. It deliberately does not return the cookie's value: the credential is stored HttpOnly so an XSS in the console cannot exfiltrate mesh admin rights, and handing the raw token back to any same-origin fetch would undo exactly that. The SPA never needs it, since the reverse proxy injects the cookie as Authorization for /api/ calls.

func (*Server) HandleTokenLogin

func (s *Server) HandleTokenLogin(w http.ResponseWriter, r *http.Request)

HandleTokenLogin exchanges a token the operator pasted into the console for an httpOnly session cookie, so the credential is never reachable from JavaScript and an XSS in the console cannot exfiltrate mesh admin rights.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Jump to

Keyboard shortcuts

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