password

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package password provides password management through bcrypt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPassword

func NewPassword(options ...ConfigOption) auth.PasswordService

NewPassword returns a new password validator.

Types

type ConfigOption

type ConfigOption func(*Password)

ConfigOption configures the validator.

func WithCost

func WithCost(cost int) ConfigOption

WithCost configures the service with a cost.

func WithMaxLength

func WithMaxLength(length int) ConfigOption

WithMaxLength sets a maximum password length.

func WithMinLength

func WithMinLength(length int) ConfigOption

WithMinLength sets a minimum password length.

type Password

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

Password is a credential validator for password authentication.

func (*Password) Hash

func (p *Password) Hash(password string) ([]byte, error)

Hash hashes a password for storage.

func (*Password) OKForUser

func (p *Password) OKForUser(password string) error

OKForUser tells us if a password meets minimum requirements to be set for any users.

func (*Password) Validate

func (p *Password) Validate(user *auth.User, password string) error

Validate validates if a submitted password is valid for a stored password hash.

Jump to

Keyboard shortcuts

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