osauth

package
v0.14.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPasswdFilename = "/etc/passwd"
View Source
var DefaultShadowFilename = "/etc/shadow"
View Source
var ErrUserNotFound = errors.New("user not found")

ErrUserNotFound is returned when the user is not found in the passwd file.

Functions

This section is empty.

Types

type OSAuth added in v0.13.0

type OSAuth struct{}

func (*OSAuth) AuthUser added in v0.13.0

func (l *OSAuth) AuthUser(username, password string) bool

func (*OSAuth) AuthUserFromShadow added in v0.13.0

func (l *OSAuth) AuthUserFromShadow(username string, password string, shadow io.Reader) bool

AuthUserFromShadow checks if the given username and password are valid for the given shadow file.

func (*OSAuth) LookupUser added in v0.13.0

func (l *OSAuth) LookupUser(username string) *User

func (*OSAuth) LookupUserFromPasswd added in v0.13.0

func (l *OSAuth) LookupUserFromPasswd(username string, passwd io.Reader) (*User, error)

LookupUserFromPasswd reads the passwd file from the given reader and returns the user, if found. TODO: Use this function inside the LookupUser.

func (*OSAuth) VerifyPasswordHash added in v0.13.0

func (l *OSAuth) VerifyPasswordHash(hash, password string) bool

type OSAuther added in v0.13.0

type OSAuther interface {
	AuthUser(username, password string) bool
	AuthUserFromShadow(username, password string, shadow io.Reader) bool
	VerifyPasswordHash(hash, password string) bool
	LookupUser(username string) *User
	LookupUserFromPasswd(username string, passwd io.Reader) (*User, error)
}

type ShadowEntry

type ShadowEntry struct {
	Username    string // Login name
	Password    string // Hashed password
	Lastchanged int    // Days since Jan 1, 1970 that password was last changed
	Minimum     int    // The minimum number of days required between password changes i.e. the number of days left before the user is allowed to change his/her password
	Maximum     int    // The maximum number of days the password is valid (after that user is forced to change his/her password)
	Warn        int    // The number of days before password is to expire that user is warned that his/her password must be changed
	Inactive    int    // The number of days after password expires that account is disabled
	Expire      int    // Days since Jan 1, 1970 that account is disabled i.e. an absolute date specifying when the login may no longer be used.
}

type User

type User struct {
	UID      uint32
	GID      uint32
	Username string
	Password string
	Name     string
	HomeDir  string
	Shell    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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