agdpasswd

package
v0.0.0-...-f179113 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package agdpasswd contains authentication utils.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowAuthenticator

type AllowAuthenticator struct{}

AllowAuthenticator is an empty authenticator implementation that always grants access, regardless of any restrictions.

func (AllowAuthenticator) Authenticate

func (AllowAuthenticator) Authenticate(_ context.Context, _ []byte) (ok bool)

Authenticate implements the Authenticator interface for AllowAuthenticator.

type Authenticator

type Authenticator interface {
	// Authenticate returns true if the given passwd is allowed.
	Authenticate(ctx context.Context, passwd []byte) (ok bool)
}

Authenticator represents a password authenticator.

type PasswordHashBcrypt

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

PasswordHashBcrypt is the Bcrypt implementation of Authenticator.

func NewPasswordHashBcrypt

func NewPasswordHashBcrypt(hashedPassword []byte) (p *PasswordHashBcrypt)

NewPasswordHashBcrypt returns a new bcrypt hashed password authenticator.

func (*PasswordHashBcrypt) Authenticate

func (p *PasswordHashBcrypt) Authenticate(_ context.Context, passwd []byte) (ok bool)

Authenticate implements the Authenticator interface for *PasswordHashBcrypt.

func (*PasswordHashBcrypt) PasswordHash

func (p *PasswordHashBcrypt) PasswordHash() (b []byte)

PasswordHash returns password hash bytes slice.

Jump to

Keyboard shortcuts

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