config

package
v0.0.0-...-3db709f Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Path    = "/etc/kubernetes/gitlab-authn.yaml"
	WebPath = "/usr/share/kubernetes-gitlab-authn/public"
)

Variables

This section is empty.

Functions

func NewRealms

func NewRealms() map[string]RealmAccessList

Types

type Cache

type Cache struct {
	TTL Duration `json:"ttl"`
}

func NewCache

func NewCache() *Cache

func (*Cache) ExpirationTime

func (c *Cache) ExpirationTime() time.Duration

type Config

type Config struct {
	Realms  Realms   `json:"realms"`
	Gitlab  *Gitlab  `json:"gitlab"`
	Server  *Server  `json:"server"`
	Health  *Health  `json:"health"`
	Metrics *Metrics `json:"metrics"`
	Cache   *Cache   `json:"cache"`
	Web     *Web     `json:"web"`
	// contains filtered or unexported fields
}

func New

func New() *Config

func (*Config) LoadFile

func (c *Config) LoadFile(path string) error

func (*Config) Set

func (c *Config) Set(path string) error

Set is an alias for Config.LoadFile. It satisfies the flag.Value contract.

func (*Config) String

func (c *Config) String() string

String returns the filesystem location of the file containing the stored data. It satisfies the flag.Value contract.

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) (err error)

type Gitlab

type Gitlab struct {
	Server `json:",inline"`

	AttributesAsGroups bool              `json:"attributes_as_groups"`
	InactivityTimeout  Duration          `json:"inactivity_timeout"`
	GroupFilter        GitlabGroupFilter `json:"group_filter"`
}

func NewGitlab

func NewGitlab() *Gitlab

func (*Gitlab) CertPool

func (g *Gitlab) CertPool() (pool *x509.CertPool, err error)

func (*Gitlab) Certificates

func (g *Gitlab) Certificates() (certs []tls.Certificate, err error)

func (*Gitlab) HTTPClient

func (g *Gitlab) HTTPClient() (client *http.Client, err error)

func (*Gitlab) HTTPTransport

func (g *Gitlab) HTTPTransport() (transport http.RoundTripper, err error)

func (*Gitlab) MTLS

func (g *Gitlab) MTLS() (cfg *tls.Config, err error)

func (*Gitlab) UserInfoOptions

func (g *Gitlab) UserInfoOptions() *access.UserInfoOptions

type GitlabGroupFilter

type GitlabGroupFilter struct {
	OwnedOnly      bool                    `json:"owned_only"`
	TopLevelOnly   bool                    `json:"top_level_only"`
	MinAccessLevel gitlab.AccessLevelValue `json:"min_access_level"`
	Name           string                  `json:"name"`
	Limit          uint8                   `json:"limit"`
}

func (*GitlabGroupFilter) ListOptions

func (f *GitlabGroupFilter) ListOptions() *gitlab.ListGroupsOptions

type Health

type Health struct {
	Server `json:",inline"`
}

func NewHealth

func NewHealth() *Health

type Metrics

type Metrics struct {
	Server `json:",inline"`

	RequestLimit   int           `json:"request_limit"`
	RequestTimeout time.Duration `json:"request_timeout"`
}

func NewMetrics

func NewMetrics() *Metrics

type RealmAccessList

type RealmAccessList []*RealmAccessRules

func (RealmAccessList) UserRules

func (r RealmAccessList) UserRules() userauthz.Authorizer

type RealmAccessRules

type RealmAccessRules struct {
	// Reject users without 2FA set up
	Require2FA bool `json:"require_2fa"`
	// Reject users marked as robots
	RejectBots bool `json:"reject_bots"`
	// Reject users in locked state
	RejectLocked bool `json:"reject_locked"`
	// Reject users which have not confirmed their account yet
	RejectPristine bool `json:"reject_pristine"`
	// Reject users which have not had any activity for some time
	RejectDormant bool `json:"reject_dormant"`
	// Only allow users with the given usernames
	RequireUsers []string `json:"require_users"`
	// Reject users based on their username
	RejectUsers []string `json:"reject_users"`
	// Require membership of all of these groups
	RequireGroups []string `json:"require_groups"`
	// Reject members of any of the given groups
	RejectGroups []string `json:"reject_groups"`
}

func (*RealmAccessRules) UserRules

func (r *RealmAccessRules) UserRules() userauthz.Authorizer

type Realms

type Realms map[string]RealmAccessList

func (Realms) UserAccessControlList

func (r Realms) UserAccessControlList() map[string]userauthz.Authorizer

type Server

type Server struct {
	*TLS `json:"tls"`

	Address string `json:"address"`
	Port    uint   `json:"port"`

	Path string `json:"path"`
}

func NewServer

func NewServer() *Server

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) HandlerPath

func (s *Server) HandlerPath(p string) string

func (*Server) URL

func (s *Server) URL() (*url.URL, error)

type TLS

type TLS struct {
	SkipVerify bool `json:"skip_verify"`

	CACertFile string `json:"ca_cert_file"`
	CertFile   string `json:"cert_file"`
	KeyFile    string `json:"key_file"`
}

type Web

type Web struct {
	Path        string `json:"path"`
	Description string `json:"description"`
}

func NewWeb

func NewWeb() *Web

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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