Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOAuthDisplayName added in v0.1.1

func DefaultOAuthDisplayName(providerID string) string

DefaultOAuthDisplayName returns the login button label for a provider.

func NormalizeOAuthProviderID added in v0.1.1

func NormalizeOAuthProviderID(id string) string

Types

type Config

type Config struct {
	OAuth OAuthConfig
	// AppOrigin is the public URL of the frontend (e.g. http://localhost:5173). When set, invite URLs and OAuth redirects use it; non-API requests to this server return 401 Unauthorized.
	AppOrigin string
}

func LoadFromEnv

func LoadFromEnv() *Config

func (*Config) EnabledOAuthProviders

func (c *Config) EnabledOAuthProviders() []string

EnabledOAuthProviders returns the list of provider IDs that are configured and enabled.

func (*Config) OAuthProvider

func (c *Config) OAuthProvider(providerID string) *OAuthProviderConfig

OAuthProvider returns the config for a provider ID, or nil if not configured.

type OAuthClientMTLSConfig added in v0.1.1

type OAuthClientMTLSConfig struct {
	Enabled     bool
	TLSCertFile string
	TLSKeyFile  string
	TLSVersion  uint16
}

type OAuthConfig

type OAuthConfig struct {
	Providers map[string]OAuthProviderConfig
}

type OAuthProviderConfig

type OAuthProviderConfig struct {
	ClientID            string
	ClientSecret        string // #nosec G117 -- OAuth client secret from config, not logged
	Scopes              []string
	AuthURL             string
	TokenURL            string
	UserInfoURL         string
	UserIDClaim         string // JSON claim for provider user id; default "sub"
	EmailClaim          string // JSON claim for email; default "email"
	EmailsURL           string // Optional second URL returning a JSON array when email is not on userinfo (e.g. GitHub /user/emails)
	EmailsPrimaryClaim  string // Claim on array entries marking the preferred email; default "primary"
	EmailVerifiedClaim  string // Userinfo claim that must be true when email comes from userinfo (e.g. email_verified)
	EmailsVerifiedClaim string // Emails-list entry claim that must be true (e.g. verified on GitHub /user/emails)
	AllowEmailMatch     bool   // Allow signing in to an existing account by email alone; default false
	DisplayName         string // Login/signup button label; default derived from provider id
	ClientMTLS          OAuthClientMTLSConfig
}

func (OAuthProviderConfig) BuildHTTPClient added in v0.1.1

func (p OAuthProviderConfig) BuildHTTPClient() (*http.Client, error)

func (OAuthProviderConfig) Enabled added in v0.1.1

func (p OAuthProviderConfig) Enabled() bool

Jump to

Keyboard shortcuts

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