auth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginCookie   = "uhppoted-httpd-login"
	SessionCookie = "uhppoted-httpd-session"
)

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) Preauthenticate

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

func (*Basic) Verify

func (b *Basic) Verify(uid, pwd 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
}

type None

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

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) Preauthenticate

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

func (*None) Verify

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

Jump to

Keyboard shortcuts

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