auth

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Basic

type Basic struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewBasic

func NewBasic(auth auth.IAuthenticate, file string, cookieMaxAge int) (*Basic, error)

func (*Basic) Authenticate

func (b *Basic) Authenticate(uid, pwd string, cookie *http.Cookie) (*http.Cookie, error)

NTS: the uhppoted-httpd-login cookie is a single use expiring cookie

intended to (eventually) support opaque login credentials

func (*Basic) Authenticated

func (b *Basic) Authenticated(cookie *http.Cookie) (string, string, *http.Cookie, error)

func (*Basic) Authorised

func (b *Basic) Authorised(uid, role, path string) error

func (*Basic) Logout

func (b *Basic) Logout(cookie *http.Cookie)

func (*Basic) Options added in v0.8.3

func (b *Basic) Options(uid, role string) options

func (*Basic) Preauthenticate

func (b *Basic) Preauthenticate() (*http.Cookie, error)

func (*Basic) Verify

func (b *Basic) Verify(uid, pwd string) error

func (*Basic) VerifyAuthHeader added in v0.8.3

func (b *Basic) VerifyAuthHeader(uid string, header string) error

type IAuth

type IAuth interface {
	Preauthenticate() (*http.Cookie, error)
	Authenticate(uid, pwd string, cookie *http.Cookie) (*http.Cookie, error)
	Authenticated(cookie *http.Cookie) (string, string, *http.Cookie, error)
	Authorised(uid, role, path string) error
	Logout(cookie *http.Cookie)

	Verify(uid, pwd string) error
	VerifyAuthHeader(uid string, header string) error
	Options(uid, role string) options
}

type None

type None struct {
}

func NewNoneAuthenticator

func NewNoneAuthenticator() *None

func (*None) Authenticate

func (n *None) Authenticate(uid, pwd string, cookie *http.Cookie) (*http.Cookie, error)

func (*None) Authenticated

func (n *None) Authenticated(cookie *http.Cookie) (string, string, *http.Cookie, error)

func (*None) Authorised

func (n *None) Authorised(uid, role, path string) error

func (*None) Logout

func (n *None) Logout(cookie *http.Cookie)

func (*None) Options added in v0.8.3

func (n *None) Options(uid, role string) options

func (*None) Preauthenticate

func (n *None) Preauthenticate() (*http.Cookie, error)

func (*None) Verify

func (n *None) Verify(uid, pwd string) error

func (*None) VerifyAuthHeader added in v0.8.3

func (n *None) VerifyAuthHeader(uid string, header string) error

Jump to

Keyboard shortcuts

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