mfa

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProviderNotFound = fmt.Errorf("provider not found")
)

Functions

func RegisterProviderFactory

func RegisterProviderFactory(factory ProviderFactory)

func SetupWithOptions

func SetupWithOptions(p cache.Interface, opts *Options) error

Types

type Options

type Options struct {
	Enabled      bool              `json:"enabled" yaml:"enabled"`
	MFAProviders []ProviderOptions `json:"mfaProviders" yaml:"mfaProviders"`
}

func NewOptions

func NewOptions() *Options

func (*Options) AddFlags

func (a *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) Validate

func (a *Options) Validate() []error

type Provider

type Provider interface {
	Verify(req url.Values, info user.Info) error
	Request(info user.Info) error
	UserProviderConfig(info user.Info, token string) UserMFAProvider
}

func GetProvider

func GetProvider(providerType string) (Provider, error)

type ProviderFactory

type ProviderFactory interface {
	Type() string
	Create(cache cache.Interface, options oauth.DynamicOptions) (Provider, error)
}

type ProviderOptions

type ProviderOptions struct {
	Type    string               `json:"type" yaml:"type"`
	Options oauth.DynamicOptions `json:"options" yaml:"options"`
}

type UserMFAProvider

type UserMFAProvider struct {
	Type  string `json:"type,omitempty"`
	Token string `json:"token,omitempty"`
	Value string `json:"value,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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