browserauth

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package browserauth implements read-only browser identity and SP-initiated SAML. XML/signature validation belongs to crewjam/saml; opaque credentials live in PostgreSQL.

Index

Constants

View Source
const CallbackLimit = 1 << 20
View Source
const CookieName = "__Host-orpheus_session"

Variables

View Source
var ErrNoSession = errors.New("browser session absent")

Functions

func Cleanup

func Cleanup(ctx context.Context, pool *pgxpool.Pool)

Cleanup runs independently of request authorization. Every batch has its own short statement and SKIP LOCKED lets replicas share expiry cleanup safely.

func ClearCookie

func ClearCookie(w http.ResponseWriter)

Types

type Identity

type Identity struct {
	TokenHash   []byte
	DisplayName string
	ExpiresAt   time.Time
}

type Service

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

func New

func New(c config.BrowserAuth, pool *pgxpool.Pool) (*Service, error)

func (*Service) Authenticate

func (s *Service) Authenticate(r *http.Request) (*Identity, error)

func (*Service) Callback

func (s *Service) Callback(w http.ResponseWriter, r *http.Request) error

func (*Service) Identity

func (s *Service) Identity(ctx context.Context, hash []byte) (*Identity, error)

func (*Service) Login

func (s *Service) Login(w http.ResponseWriter, r *http.Request) error

func (*Service) Logout

func (s *Service) Logout(w http.ResponseWriter, r *http.Request) error

func (*Service) Metadata

func (s *Service) Metadata(w http.ResponseWriter, _ *http.Request) error

func (*Service) Mode

func (s *Service) Mode() string

func (*Service) State

func (s *Service) State(w http.ResponseWriter, r *http.Request) (State, error)

type State

type State struct {
	Mode          string     `json:"mode"`
	Authenticated bool       `json:"authenticated"`
	ReadAccess    bool       `json:"read_access"`
	User          *User      `json:"user"`
	ExpiresAt     *time.Time `json:"expires_at"`
}

type User

type User struct {
	DisplayName string `json:"display_name"`
}

Jump to

Keyboard shortcuts

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