login

package
v0.30.71 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration map[string]Flow

Configuration defines available authentication flows.

type Context

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

Context coordinates the entire login process.

func New

func New(flow string) *Context

New creates a Context from the configured flow reference. `flow` is used as the path into the application configuration.

func NewFlow

func NewFlow(flow Flow) *Context

NewFlow creates a Context from the supplied flow entries.

func (*Context) Login

func (c *Context) Login(
	handler miruken.Handler,
) *promise.Promise[security.Subject]

Login performs the authentication. returns the authenticated security.Subject or and error if authentication failed.

func (*Context) Logout

func (c *Context) Logout(
	handler miruken.Handler,
) *promise.Promise[security.Subject]

Logout the security.Subject.

type Error

type Error struct {
	Cause error
}

Error reports a failure during the login process.

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type Flow

type Flow []ModuleEntry

Flow lists the modules in an authentication process.

func (Flow) Validate added in v0.30.69

func (f Flow) Validate() error

type Module

type Module interface {
	// Login authenticates the subject.
	// It can use the supplied handler to prompt for
	// information such as username or password.
	Login(
		subject security.Subject,
		handler miruken.Handler,
	) error

	// Logout logs out the subject by remove principals
	// and/or credentials from the subject.
	Logout(
		subject security.Subject,
		handler miruken.Handler,
	) error
}

Module is responsible for implementing an authentication strategy. e.g. basic username/password, oauth token

type ModuleEntry

type ModuleEntry struct {
	Module  string
	Options map[string]any
}

ModuleEntry defines a single module in the login Configuration.

func (ModuleEntry) Validate added in v0.30.69

func (m ModuleEntry) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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