realm_chain

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MPL-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthFailed = errors.New("no realm could authenticate these credentials")
	ErrNilRealm   = errors.New("registering a nil realm is not allowed")
)

Functions

func Init

func Init(authConfig *config.AuthConfiguration, apiKeyRepo datastore.APIKeyRepository, userRepo datastore.UserRepository, cache cache.Cache) error

Types

type RealmChain

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

RealmChain represents a group of realms to be called for authentication. When RealmChain.Authenticate is called, the Authenticate method of all registered realms is called. If at least one realm can authenticate the given auth.Credential, RealmChain.Authenticate will not return an error

func Get

func Get() (*RealmChain, error)

func (*RealmChain) Authenticate

func (rc *RealmChain) Authenticate(ctx context.Context, cred *auth.Credential) (*auth.AuthenticatedUser, error)

Authenticate calls the Authenticate method of all registered realms. If at least one realm can authenticate the given auth.Credential, Authenticate will not return an error

func (*RealmChain) RegisterRealm

func (rc *RealmChain) RegisterRealm(r auth.Realm) error

Jump to

Keyboard shortcuts

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