browserauth

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 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 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