util

package
v0.0.0-...-0578048 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice []string, s string) bool

Helper functions to check and remove string from a slice of strings.

ContainsString check if string exists in slice

func ConvertConfigMapToToken

func ConvertConfigMapToToken(cm *corev1.ConfigMap) string

ConvertConfigMapToToken converts the ConfigMap into a unique token based on the data values

func RemoveString

func RemoveString(slice []string, s string) (result []string)

RemoveString removes string from slice

func ToStorageConnector

func ToStorageConnector(c Connector) (storage.Connector, error)

ToStorageConnector converts an object to storage connector type.

func UpdateDexDeployment

func UpdateDexDeployment(deployment *appsv1.Deployment, token string) bool

UpdateDexDeployment checks if checksum matches the one in the Deployment annotation

Types

type Config

type Config struct {
	Issuer    string    `json:"issuer"`
	Storage   Storage   `json:"storage"`
	Web       Web       `json:"web"`
	Telemetry Telemetry `json:"telemetry"`
	OAuth2    OAuth2    `json:"oauth2"`
	GRPC      GRPC      `json:"grpc"`
	Expiry    Expiry    `json:"expiry"`
	Logger    Logger    `json:"logger"`

	Frontend server.WebConfig `json:"frontend"`

	// StaticConnectors are user defined connectors specified in the ConfigMap
	// Write operations, like updating a connector, will fail.
	StaticConnectors []Connector `json:"connectors"`

	// StaticClients cause the server to use this list of clients rather than
	// querying the storage. Write operations, like creating a client, will fail.
	StaticClients []storage.Client `json:"staticClients"`

	// If enabled, the server will maintain a list of passwords which can be used
	// to identify a user.
	EnablePasswordDB bool `json:"enablePasswordDB"`

	// StaticPasswords cause the server use this list of passwords rather than
	// querying the storage. Cannot be specified without enabling a passwords
	// database.
	StaticPasswords []password `json:"staticPasswords"`
}

Config is the config format for the main application.

type Connector

type Connector struct {
	Type string `json:"type"`
	Name string `json:"name"`
	ID   string `json:"id"`

	Config server.ConnectorConfig `json:"config"`
}

Connector is a magical type that can unmarshal YAML dynamically. The Type field determines the connector type, which is then customized for Config.

func (*Connector) UnmarshalJSON

func (c *Connector) UnmarshalJSON(b []byte) error

UnmarshalJSON allows Connector to implement the unmarshaler interface to dynamically determine the type of the connector config.

type Expiry

type Expiry struct {
	// SigningKeys defines the duration of time after which the SigningKeys will be rotated.
	SigningKeys string `json:"signingKeys"`

	// IdTokens defines the duration of time for which the IdTokens will be valid.
	IDTokens string `json:"idTokens"`

	// AuthRequests defines the duration of time for which the AuthRequests will be valid.
	AuthRequests string `json:"authRequests"`
}

Expiry holds configuration for the validity period of components.

type GRPC

type GRPC struct {
	// The port to listen on.
	Addr        string `json:"addr"`
	TLSCert     string `json:"tlsCert"`
	TLSKey      string `json:"tlsKey"`
	TLSClientCA string `json:"tlsClientCA"`
	Reflection  bool   `json:"reflection"`
}

GRPC is the config for the gRPC API.

type Logger

type Logger struct {
	// Level sets logging level severity.
	Level string `json:"level"`

	// Format specifies the format to be used for logging.
	Format string `json:"format"`
}

Logger holds configuration required to customize logging for dex.

type OAuth2

type OAuth2 struct {
	ResponseTypes []string `json:"responseTypes"`
	// If specified, do not prompt the user to approve client authorization. The
	// act of logging in implies authorization.
	SkipApprovalScreen bool `json:"skipApprovalScreen"`
	// If specified, show the connector selection screen even if there's only one
	AlwaysShowLoginScreen bool `json:"alwaysShowLoginScreen"`
}

OAuth2 describes enabled OAuth2 extensions.

type Storage

type Storage struct {
	Type   string        `json:"type"`
	Config StorageConfig `json:"config"`
}

Storage holds app's storage configuration.

func (*Storage) UnmarshalJSON

func (s *Storage) UnmarshalJSON(b []byte) error

UnmarshalJSON allows Storage to implement the unmarshaler interface to dynamically determine the type of the storage config.

type StorageConfig

type StorageConfig interface {
	Open(logger log.Logger) (storage.Storage, error)
}

StorageConfig is a configuration that can create a storage.

type Telemetry

type Telemetry struct {
	HTTP string `json:"http"`
}

Telemetry is the config format for telemetry including the HTTP server config.

type Web

type Web struct {
	HTTP           string   `json:"http"`
	HTTPS          string   `json:"https"`
	TLSCert        string   `json:"tlsCert"`
	TLSKey         string   `json:"tlsKey"`
	AllowedOrigins []string `json:"allowedOrigins"`
}

Web is the config format for the HTTP server.

Jump to

Keyboard shortcuts

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