lpasswd

package module
v0.0.0-...-0c85038 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 12 Imported by: 0

README

Simple library to manage and verify logins against app-local or system accounts. Includes a simple CLI util to add/set user accounts to a local password file using bcrypt.

Typical uses include CLI login or HTTP basic authentication.

Documentation

Overview

lpasswd - lib to handle storage and lookup of app-local users with passwords akin to /etc/passwd.

Copyright (c) 2017-2020 Russell Magee Licensed under the terms of the MIT license (see LICENSE.mit in this distribution)

golang implementation by Russ Magee (rmagee_at_gmail.com)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthUserByPasswd

func AuthUserByPasswd(ctx *AuthCtx, sysacct bool, username string, auth string, fname string) (valid bool, err error)

AuthUserByPasswd checks user login information using a password. This checks file _fname_ for auth info, and optionally system /etc/passwd to cross-check the user actually exists, if sysacct == true. nolint: gocyclo

func SetPasswd

func SetPasswd(uname, passwd, passwdFName string) (e error)

SetPasswd enters _uname_ with the specified _passwd_ into the local password file _passwdFName_.

func VerifyPass

func VerifyPass(ctx *AuthCtx, user, password string) (bool, error)

VerifyPass verifies a password against system standard shadow file Note auxilliary fields for expiry policy are *not* inspected.

Types

type AuthCtx

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

func NewAuthCtx

func NewAuthCtx() (ret *AuthCtx)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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