oauth

package
v3.31.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EvtUserLogin indicates a user login.
	EvtUserLogin = events.Define(
		"oauth.user.login", "login user successful",
		events.WithVisibility(ttnpb.Right_RIGHT_USER_ALL),
		events.WithAuthFromContext(),
		events.WithClientInfoFromContext(),
	)
	// EvtUserLogout indicates a user logout.
	EvtUserLogout = events.Define(
		"oauth.user.logout", "logout user",
		events.WithVisibility(ttnpb.Right_RIGHT_USER_ALL),
		events.WithAuthFromContext(),
		events.WithClientInfoFromContext(),
	)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Mount       string   `name:"mount" description:"Path on the server where the Account application and OAuth services will be served"`
	UI          UIConfig `name:"ui"`
	CSRFAuthKey []byte   `name:"-"`
}

Config is the configuration for the OAuth server.

type FrontendConfig

type FrontendConfig struct {
	DocumentationBaseURL   string `json:"documentation_base_url" name:"documentation-base-url" description:"The base URL for generating documentation links"`
	StatusPage             string `json:"status_page_base_url" name:"status-page-base-url" description:"The base URL for generating status page links"`
	Language               string `json:"language" name:"-"`
	StackConfig            `json:"stack_config" name:",squash"`
	EnableUserRegistration bool   `json:"enable_user_registration" name:"-"`
	ConsoleURL             string `json:"console_url" name:"console-url" description:"The URL that points to the root of the Console"`
}

FrontendConfig is the configuration for the OAuth frontend.

type Server

type Server interface {
	web.Registerer

	Authorize(authorizePage http.Handler) http.HandlerFunc
	Token(w http.ResponseWriter, r *http.Request)
}

Server is the interface for the OAuth server.

func NewServer

func NewServer(c *component.Component, store oauth_store.TransactionalInterface, config Config, cspFunc func(config *Config, nonce string) string) (Server, error)

NewServer returns a new OAuth server on top of the given store.

type StackConfig

type StackConfig struct {
	IS webui.APIConfig `json:"is" name:"is"`
}

StackConfig is the configuration of the stack components.

type UIConfig

type UIConfig struct {
	webui.TemplateData `name:",squash"`
	FrontendConfig     `name:",squash"`
}

UIConfig is the combined configuration for the OAuth and Account UI.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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