advauth

package
v0.0.0-...-5dcd16a Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auther

type Auther struct {
	Base  *fastnntp.Handler
	Deriv Deriver
	Hook  LoginHookLite
	// contains filtered or unexported fields
}

func (*Auther) AuthinfoCheckPrivilege

func (a *Auther) AuthinfoCheckPrivilege(p fastnntp.LoginPriv, h *fastnntp.Handler) bool

Checks a privilege. Returns true if it is allowed.

func (*Auther) AuthinfoDone

func (a *Auther) AuthinfoDone(h *fastnntp.Handler) bool

This Method SHOULD return true, if authentication has already occurred.

func (*Auther) AuthinfoUserOny

func (a *Auther) AuthinfoUserOny(user []byte, oldh *fastnntp.Handler) (bool, *fastnntp.Handler)

This Method returns true, if the combination of username is accepted without password. The method can optionally return a new Handler object in place of the old one.

func (*Auther) AuthinfoUserPass

func (a *Auther) AuthinfoUserPass(user, password []byte, oldh *fastnntp.Handler) (bool, *fastnntp.Handler)

This Method returns true, if the combination of username and password is accepted.

func (a *Auther) Backlink()
type Backlink struct {
	Rank postauth.AuthRank
}

func (*Backlink) AuthinfoCheckPrivilege

func (b *Backlink) AuthinfoCheckPrivilege(p fastnntp.LoginPriv, h *fastnntp.Handler) bool

Checks a privilege. Returns true if it is allowed.

func (*Backlink) AuthinfoDone

func (b *Backlink) AuthinfoDone(h *fastnntp.Handler) bool

This Method SHOULD return true, if authentication has already occurred.

func (*Backlink) AuthinfoUserOny

func (b *Backlink) AuthinfoUserOny(user []byte, oldh *fastnntp.Handler) (bool, *fastnntp.Handler)

This Method returns true, if the combination of username is accepted without password. The method can optionally return a new Handler object in place of the old one.

func (*Backlink) AuthinfoUserPass

func (b *Backlink) AuthinfoUserPass(user, password []byte, oldh *fastnntp.Handler) (bool, *fastnntp.Handler)

This Method returns true, if the combination of username and password is accepted.

type DefaultDeriver

type DefaultDeriver struct{}

Implements Deriver

func (DefaultDeriver) DeriveRank

func (DefaultDeriver) DeriveRankUserOpt

func (d DefaultDeriver) DeriveRankUserOpt(h *fastnntp.Handler, r postauth.AuthRank, user []byte) *fastnntp.Handler

type Deriver

type Deriver interface {
	// This must not return nil
	// The results of this method will be cached.
	DeriveRank(h *fastnntp.Handler, r postauth.AuthRank) *fastnntp.Handler

	// This might return nil
	// This hook enables the implementor to implement its own policy
	// based upon the user's name rather than just the rank.
	// This is useful, for example, to implement accounting such as download volume,
	// or to implement per-newsgroup ACLs.
	//
	// Note, that the results will not be cached, please do it yourself.
	DeriveRankUserOpt(h *fastnntp.Handler, r postauth.AuthRank, user []byte) *fastnntp.Handler
}

type LoginAdm

type LoginAdm interface {
	InsertUser(user, password []byte, rank postauth.AuthRank) error
	UpdateUserPassword(user, password []byte) error
	UpdateUserRank(user []byte, rank postauth.AuthRank) error
}

type LoginHook

type LoginHook interface {
	LoginHookLite
	LoginAdm
}

type LoginHookLite

type LoginHookLite interface {
	AuthUserOnly(user []byte) (postauth.AuthRank, bool)
	AuthUserPass(user, password []byte) (postauth.AuthRank, bool)
}

Jump to

Keyboard shortcuts

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