Categorygithub.com/tg123/go-htpasswd
modulepackage
1.2.3
Repository: https://github.com/tg123/go-htpasswd.git
Documentation: pkg.go.dev

# README

htpasswd for Go

Go Doc Go Report Card

This is a libary to validate user credentials against an HTTPasswd file.

This was forked from https://github.com/jimstudt/http-authentication/tree/master/basic with modifications by @brian-avery to support SSHA, Md5Crypt, and Bcrypt and @jespersoderlund to support Crypt with SHA-256 and SHA-512 support.

Currently, this supports:

  • SSHA
  • MD5Crypt
  • APR1Crypt
  • SHA
  • Bcrypt
  • Plain text
  • Crypt with SHA-256 and SHA-512

# Functions

AcceptBcrypt accepts any valid password encoded using bcrypt.
Accepts valid passwords.
AcceptMd5 accepts valid MD5 encoded passwords.
AcceptPlain accepts any password in the plain text encoding.
AcceptSha accepts valid SHA encoded passwords.
AcceptSsha accepts any valid password encoded using bcrypt.
New creates an File from an Apache-style htpasswd file for HTTP Basic Authentication.
NewFromReader is like new but reads from r instead of a named file.
NewGroups creates a HTGroup from an Apache-style group file.
NewGroupsFromReader is like NewGroups but reads from r instead of a named file.
RejectBcrypt rejects any password encoded using bcrypt.
RejectCryptSha known indexes.
RejectMd5 rejects any MD5 encoded password.
RejectPlain rejects any plain text encoded password.
RejectSha rejects any password encoded as SHA.
RejectSsha rejects any password encoded using SSHA1.

# Constants

PrefixCryptApr1 is the Apache Apr1 hash prefix.
PrefixCryptMd5 is the Md5crypt hash prefix.
Prefixes.
No description provided by the author
No description provided by the author

# Variables

DefaultSystems is an array of PasswdParser including all builtin parsers.

# Structs

An File encompasses an Apache-style htpasswd file for HTTP Basic authentication.
A HTGroup encompasses an Apache-style group file.

# Interfaces

An EncodedPasswd is created from the encoded password in a password file by a PasswdParser.

# Type aliases

A BadLineHandler is used to notice bad lines in a password file.
PasswdParser examines an encoded password, and if it is formatted correctly and sane, return an EncodedPasswd which will recognize it.