auth

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const PkgName = "auxo.net.web.filter.auth"

Variables

This section is empty.

Functions

This section is empty.

Types

type Basic

type Basic struct {
	Validator func(name string, pwd string) web.User
}

Basic implements Basic authentication.

func NewBasic

func NewBasic(validator func(name string, pwd string) web.User) *Basic

NewBasic returns an Basic authenticate filter.

func (*Basic) Apply

func (b *Basic) Apply(next web.HandlerFunc) web.HandlerFunc

Apply implements `web.Filter` interface.

type Form

type Form struct {
	CookieName        string // default '_u'
	CookieDomain      string
	CookiePath        string
	DefaultURL        string
	Remember          bool
	SlidingExpiration bool
	Timeout           time.Duration
	Identifier        FormIdentifier
}

Form implements form authentication.

func NewForm

func NewForm(identifier FormIdentifier) *Form

NewForm returns an Form authenticate filter.

func (*Form) Apply

func (f *Form) Apply(next web.HandlerFunc) web.HandlerFunc

Apply implements `web.Filter` interface.

func (*Form) Login

func (f *Form) Login(validator FormValidator) web.HandlerFunc

Login returns a handler for sign-in.

func (*Form) LoginForm

func (f *Form) LoginForm(validator func(name, pwd string) (ticket string, err error)) web.HandlerFunc

func (*Form) LoginJSON

func (f *Form) LoginJSON(validator func(name, pwd string) (ticket string, err error)) web.HandlerFunc

func (*Form) Logout

func (f *Form) Logout(ctx web.Context) error

Logout is a handler for sign-out.

type FormIdentifier

type FormIdentifier func(ticket string) web.User

FormIdentifier defines a function to identify user ticket.

type FormValidator

type FormValidator func(ctx web.Context) (ticket string, err error)

FormValidator defines a function to validate FormAuth credentials.

Jump to

Keyboard shortcuts

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