config

package
v0.0.0-...-50dd056 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TemplateJSON = `` /* 1268-byte string literal not displayed */

	MockStaticSecret    = "mocktestsecret"
	MockStaticAttribute = "authzattrib"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLogLine

type AuditLogLine struct {
	Username      string    `json:"Username"`
	UserDomain    string    `json:"UserDomain"`
	UserSessionID string    `json:"UserSessionID"`
	Time          time.Time `json:"Time"`
	EventType     string    `json:"EventType"`
	UUID          string    `json:"EventUUID"`
	Detail        string    `json:"Detail"`
}

type Authentication

type Authentication struct {
	Kerberos             Kerberos  `json:"Kerberos"`
	Basic                BasicAuth `json:"Basic"`
	JWT                  JWT       `json:"JWT"`
	ActiveSessionTimeout int       `json:"ActiveSessionTimeout"` // Duration in minutes
	SessionDuration      int       `json:"SessionDuration"`      // Duration in minutes
}

type BasicAuth

type BasicAuth struct {
	Enabled  bool        `json:"Enabled"`
	Realm    string      `json:"Realm"`
	Protocol string      `json:"Protocol"` // Kerberos or LDAP or Static
	Kerberos KRB5Basic   `json:"Kerberos"`
	LDAP     LDAPBasic   `json:"LDAP"`
	Static   StaticBasic `json:"Static"`
}

type Config

type Config struct {
	Server   Server   `json:"Server"`
	Vault    Vault    `json:"Vault"`
	Database Database `json:"Database"`
}

func IntgTest

func IntgTest() *Config

func Load

func Load(cfgPath string) (*Config, error)

func Mock

func Mock() (*Config, string)

Mock returns a minimal config for testing

func NewConfig

func NewConfig() *Config

func Parse

func Parse(b []byte) (c *Config, err error)

func (Config) AccessLog

func (c Config) AccessLog(v interface{})

func (Config) ApplicationLogf

func (c Config) ApplicationLogf(format string, v ...interface{})

func (Config) AuditLog

func (c Config) AuditLog(v interface{})

func (*Config) SetAccessEncoder

func (c *Config) SetAccessEncoder(e *json.Encoder) *Config

func (*Config) SetAccessLogFile

func (c *Config) SetAccessLogFile(p string) *Config

func (*Config) SetApplicationLogFile

func (c *Config) SetApplicationLogFile(p string) *Config

func (*Config) SetApplicationLogger

func (c *Config) SetApplicationLogger(l *log.Logger) *Config

func (*Config) SetAuditLogFile

func (c *Config) SetAuditLogFile(p string) *Config

func (*Config) SetAuditLogger

func (c *Config) SetAuditLogger(e *json.Encoder) *Config

func (*Config) SetSocket

func (c *Config) SetSocket(s string) *Config

func (*Config) SetTLS

func (c *Config) SetTLS(tlsConf TLS) *Config

func (*Config) SetVault

func (c *Config) SetVault(addr, caFilePath, appID, userID, secretsRoot string) *Config

func (Config) Summary

func (c Config) Summary() string

func (*Config) ToString

func (c *Config) ToString() string

type Database

type Database struct {
	ConnectionString     string `json:"ConnectionString"`
	CredentialsVaultPath string `json:"CredentialsVaultPath"`
}

type JWT

type JWT struct {
	Enabled bool `json:"Enabled"`
}

type KRB5Basic

type KRB5Basic struct {
	KRB5ConfPath    string `json:"KRB5ConfPath"`
	Conf            *krb5config.Config
	KeytabVaultPath string `json:"KeytabVaultPath"`
	Keytab          *keytab.Keytab
	ServiceAccount  string `json:"ServiceAccount"`
	SPN             string `json:"SPN"`
}

type Kerberos

type Kerberos struct {
	Enabled         bool   `json:"Enabled"`
	KeytabVaultPath string `json:"KeytabVaultPath"`
	Keytab          *keytab.Keytab
	ServiceAccount  string `json:"ServiceAccount"`
}

type LDAPBasic

type LDAPBasic struct {
	EndPoint                  string `json:"EndPoint"`
	BaseDN                    string `json:"BaseDN"`
	UsernameAttribute         string `json:"UsernameAttribute"` // "cn" "sAMAccountName"
	UserObjectClass           string `json:"UserObjectClass"`
	DisplayNameAttribute      string `json:"DisplayNameAttribute"`
	MembershipAttribute       string `json:"MembershipAttribute"`
	BindUserDN                string `json:"BindUserDN"`
	BindUserPasswordVaultPath string `json:"BindUserPasswordVaultPath"`
	BindUserPassword          string
	TLSEnabled                bool   `json:"TLSEnabled"`
	TrustedCAPath             string `json:"TrustedCAPath"`
	LDAPConn                  *ldap.Conn
}

type Loggers

type Loggers struct {
	AuditFile         string `json:"Audit"`
	AuditEncoder      *json.Encoder
	ApplicationFile   string `json:"Application"`
	ApplicationLogger *log.Logger
	AccessLog         string `json:"Access"`
	AccessEncoder     *json.Encoder
}

type Server

type Server struct {
	Socket         string         `json:"Socket"`
	TLS            TLS            `json:"TLS"`
	Authentication Authentication `json:"Authentication"`
	Logging        *Loggers       `json:"Logging"`
}

type StaticBasic

type StaticBasic struct {
	RequiredSecret string `json:"RequiredSecret"`
	Attribute      string `json:"Attribute"`
}

type TLS

type TLS struct {
	Enabled         bool   `json:"Enabled"`
	CertificateFile string `json:"CertificateFile"`
	KeyFile         string `json:"KeyFile"`
}

func NewTLSConfig

func NewTLSConfig(cert, key string) (TLS, error)

type Vault

type Vault struct {
	Config      *vaultclient.Config      `json:"Config"`
	Credentials *vaultclient.Credentials `json:"Credentials"`
}

Jump to

Keyboard shortcuts

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