config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecret

func GenerateSecret(len int) (string, error)

GenerateSecret Helper to generate a default secret to use

Types

type AuthPlzConfig

type AuthPlzConfig struct {
	Name               string   `yaml:"name"`
	Address            string   `yaml:"bind-address"`
	Port               string   `yaml:"bind-port"`
	ExternalAddress    string   `yaml:"external-address"`
	AllowedOrigins     []string `yaml:"allowed-origins"`
	DisableWebSecurity bool     `yaml:"disable-web-security"`

	Database     string `yaml:"database"`
	CookieSecret string `yaml:"cookie-secret"`
	TokenSecret  string `yaml:"token-secret"`

	StaticDir   string `yaml:"static-dir"`
	TemplateDir string `yaml:"template-dir"`

	TLS    TLSConfig    `yaml:"tls"`
	OAuth  OAuthConfig  `yaml:"oauth"`
	Mailer MailerConfig `yaml:"mailer"`

	MinimumPasswordLength int `yaml:"password-len"`
}

AuthPlzConfig configuration structure

func DefaultConfig

func DefaultConfig() (*AuthPlzConfig, error)

DefaultConfig Generate default configuration

func GetConfig

func GetConfig() (*AuthPlzConfig, error)

GetConfig fetches the server configuration This parses environmental variables, command line flags, and handles file based loading of configurations.

func LoadConfig

func LoadConfig(filename, envPrefix string) (*AuthPlzConfig, error)

LoadConfig loads configuration from the specified file, using the provided prefix for environmental vars

type CLIOptions

type CLIOptions struct {
	ConfigFile string `short:"c" long:"config" description:"AuthPlz configuration file" default:"./authplz.yml"`
	Prefix     string `short:"p" long:"prefix" description:"Prefix for environmental variable loading" default:"AUTHPLZ_"`
}

CLIOptions defines options that can be passed on the command line other options must be passed through the configuration file

type MailerConfig

type MailerConfig struct {
	Driver  string            `yaml:"driver"`
	Options map[string]string `yaml:"options"`
}

MailerConfig Mailer configuration options

type OAuthConfig

type OAuthConfig struct {
	// Redirect to client app for oauth authorization
	AuthorizeRedirect string
	// Secret for OAuth token attestation
	TokenSecret string
	// AllowedScopes defines the scopes a client can grant for admins and users
	AllowedScopes configSplit
	// AllowedGrants defines the grant types a client can support for admins and users
	AllowedGrants configSplit
	// AllowedResponses defines response types a client can support
	AllowedResponses []string
	// AccessExpiry is Access Token expiry time
	AccessExpiry time.Duration
	// IDExpiry is ID Token expiry time
	IDExpiry time.Duration
	// AuthorizeExpiry is Authorization token expiry time
	AuthorizeExpiry time.Duration
	// RefreshExpiry is Refresh token expiry time
	RefreshExpiry time.Duration
}

OAuthConfig OAuth controller configuration structure

func DefaultOAuthConfig

func DefaultOAuthConfig() OAuthConfig

DefaultOAuthConfig generates a default configuration for the OAuth module

type TLSConfig

type TLSConfig struct {
	Cert     string `yaml:"cert"`
	Key      string `yaml:"key"`
	Disabled bool   `yaml:"disabled"`
}

TLSConfig TLS configuration options

Jump to

Keyboard shortcuts

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