connect

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	ID              string
	Label           string
	GrantScopes     string
	ScopeLineKeys   []string
	ScopesCannotKey string
	// ClientName is the product on the other end of the connection, used in the
	// key label and as the fallback actor on the consent page.
	ClientName         string
	TrustForwardedHost bool
	LoginPath          string

	CreateKey    func(label, scopes string) (rawKey string, id int64, err error)
	BusinessName func() string
	Language     func(r *http.Request) string
	Translate    func(lang, key string) string
	LocaleDir    func(lang string) string
	CSRFToken    func(r *http.Request) string
	CurrentUser  func(r *http.Request) (User, bool)
	Audit        func(r *http.Request, userID int64, action string, details map[string]interface{})
	Fail         func(w http.ResponseWriter, status int, msg string)
	JSON         func(w http.ResponseWriter, status int, body map[string]any)
	// contains filtered or unexported fields
}

func (*Service) Authorize

func (c *Service) Authorize(w http.ResponseWriter, r *http.Request)

Authorize renders the consent screen (GET) and, on Approve (POST), mints the key and redirects back with a one-time code. Admin session required.

func (*Service) Stylesheet

func (c *Service) Stylesheet(w http.ResponseWriter, r *http.Request)

func (*Service) Token

func (c *Service) Token(w http.ResponseWriter, r *http.Request)

Token exchanges a one-time code for the raw key. Server-to-server, no session (the code is the credential). CSRF-exempt.

type User

type User struct {
	ID    int64
	Email string
	Admin bool
}

Jump to

Keyboard shortcuts

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