pm

package
v0.0.0-...-fa57f66 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TwoFactorKindNone means no two factor authentication
	// requires user input for username and password
	TwoFactorKindNone TwoFactorKind = ""

	// TwoFactorKindOTP means one time password, provided via sms/email/auth
	// requires user input for username, password, and the one time password
	TwoFactorKindOTP = "otp"

	TwoFactorKindFIDO  = "fido"
	TwoFactorKindFIDO2 = "fido2" // also: WebAuthn
	TwoFactorKindU2F   = "u2f"
)

nolint:revive

View Source
const (
	IndexKeyUsername = "username"
	IndexKeyPassword = "password"
)

Common index keys

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(name string) (interface{}, error)

func Register

func Register(name string, f FactoryFunc, cf ConfigFactoryFunc)

Types

type ConfigFactoryFunc

type ConfigFactoryFunc func() interface{}

type CredentialUpdate

type CredentialUpdate struct {
	// Key provided when the receiver
	Key string

	// NotSynced is set to true when we observed the upstream data have changed
	// but we could not fetch the updated data in time, to notify the receiver
	// of this update that the exiting data may not be read
	NotSynced bool

	// NewValue is not nil when NotSynced is false, it is the latest value
	NewValue []byte
}

CredentialUpdate represents a update meesage for subscriber

type FactoryFunc

type FactoryFunc func(
	ctx context.Context,
	configName string,
	config interface{},
	keychainHandler security.KeychainHandler,
) (Interface, error)

type Interface

type Interface interface {
	DriverName() string

	ConfigName() string

	Login(requestUserLogin LoginInputCallbackFunc) error

	// Sync with password manager, this will build a in memory cache of all
	// credentials from password manager
	//
	// The returned channel can be nil if the implementation has no support
	// for continuous credential syncing
	//
	// The value of returned channel is always the same
	Sync(ctx context.Context) (<-chan CredentialUpdate, error)

	// Subscribe looks up in memory cahe of all credentials with the key
	// returns the cached value of the key if found
	//
	// The key format is implementation specific
	//
	// This method will return error if there is no in memory cache
	Subscribe(key string) ([]byte, error)

	// Flush previously built in memory cache
	Flush()

	Update(key string, data []byte) error
}

func NewDriver

func NewDriver(
	ctx context.Context,
	driverName string,
	configName string,
	config interface{},
	keychainHandler security.KeychainHandler,
) (Interface, error)

type LoginInput

type LoginInput struct {
	Username string
	Password string

	ValueFor2FA string
}

type LoginInputCallbackFunc

type LoginInputCallbackFunc func(t TwoFactorKind, currentInput *LoginInput) (*LoginInput, error)

LoginInputCallbackFunc used for requesting login input

when the currentInput is not nil, the returned *LoginInput should remain the same with inner field value updated according to existing values

type TwoFactorKind

type TwoFactorKind string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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