auth

package
v2.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package auth provides all authentication related features

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertPruningJob

func InsertPruningJob(ctx context.Context) error

func NewDAO

func NewDAO(o dao.DAO) dao.DAO

func ToStorageConnector

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

ToStorageConnector converts an object to storage connector type.

Types

type BoltStore

type BoltStore struct {
	// contains filtered or unexported fields
}

func NewBoltStore

func NewBoltStore(tokenBucket string, filename string) (*BoltStore, error)

func (*BoltStore) Close

func (b *BoltStore) Close() error

func (*BoltStore) DeleteToken

func (b *BoltStore) DeleteToken(t string) error

func (*BoltStore) GetInfo

func (b *BoltStore) GetInfo(value string) (string, error)

func (*BoltStore) ListTokens

func (b *BoltStore) ListTokens(offset int, count int) (chan *auth.Token, error)

func (*BoltStore) PutToken

func (b *BoltStore) PutToken(t *auth.Token) error

type Config

type Config struct {
	Issuer  string  `json:"issuer"`
	Storage Storage `json:"storage"`
	Web     Web     `json:"web"`
	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 DAO

type DAO interface {
	PutToken(t *auth.Token) error
	GetInfo(value string) (string, error)
	DeleteToken(t string) error
	ListTokens(offset int, count int) (chan *auth.Token, error)
}

type DexDAO

type DexDAO interface {
	DexPruneOfflineSessions(c Config) (pruned int64, e error)
	DexDeleteOfflineSessions(c Config, userUuid string, sessionUuid string) error
}

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"`
}

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"`
}

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"`
}

OAuth2 describes enabled OAuth2 extensions.

type PruneTokensAction

type PruneTokensAction struct{}

func (*PruneTokensAction) GetName

func (c *PruneTokensAction) GetName() string

Unique identifier

func (*PruneTokensAction) Init

func (c *PruneTokensAction) Init(job *jobs.Job, cl client.Client, action *jobs.Action) error

Pass parameters

func (*PruneTokensAction) Run

Run the actual action code

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(logrus.FieldLogger) (storage.Storage, error)
}

StorageConfig is a configuration that can create a storage.

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.

Directories

Path Synopsis
Package grpc spins an OpenID Connect Server using the coreos/dex implementation
Package grpc spins an OpenID Connect Server using the coreos/dex implementation
Package lang provides auth-related i18n strings
Package lang provides auth-related i18n strings
Package rest provides access to the TokenServiceApi
Package rest provides access to the TokenServiceApi
web
Package grpc spins an OpenID Connect Server using the coreos/dex implementation
Package grpc spins an OpenID Connect Server using the coreos/dex implementation

Jump to

Keyboard shortcuts

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