emailpassword

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHashCost = bcrypt.DefaultCost

DefaultHashCost is bcrypt's cost factor. Tests lower it (bcrypt.MinCost) for speed — same knob as the old package-level authority.PasswordHashCost.

Functions

func DummyCompare

func DummyCompare(password string, cost int)

DummyCompare burns the same time a real bcrypt comparison would, so a caller can't distinguish "no such user" from "wrong password" by timing.

func HashPassword

func HashPassword(password string, cost int) (string, error)

HashPassword is the ONLY place bcrypt.GenerateFromPassword is called in this repo. authority/credentials_password.go calls this — it never calls bcrypt directly.

func VerifyPassword

func VerifyPassword(hash, password string) error

VerifyPassword is the ONLY place bcrypt.CompareHashAndPassword is called for a real (non-dummy) comparison in this repo.

Types

type Authenticator

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

func New

func New(store auth.IdentityStore, sessions auth.SessionIssuer, notify auth.SecurityNotifier, opts ...Option) *Authenticator

New builds the email+password mode. store/sessions/notify are required ports; everything else is an Option with a safe zero-value default.

func (*Authenticator) Mount

func (a *Authenticator) Mount(r router.Router)

func (*Authenticator) Name

func (a *Authenticator) Name() string

type Option

type Option func(*Authenticator)

func WithAfterLogin

func WithAfterLogin(path string) Option

func WithRateLimit

func WithRateLimit(fn func(ip string) error) Option

func WithTrustProxy

func WithTrustProxy(v bool) Option

Jump to

Keyboard shortcuts

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