ykauth

package
v0.0.0-...-72724d7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NonceSize is the fixed value of the nonce used during exchange of requests
	NonceSize = 20
)

Variables

View Source
var (
	// ErrInvalidPassword is the error returned up the stack when password is invalid
	ErrInvalidPassword = fmt.Errorf("invalid password")
	// ErrNoUser is the error returned up the stack when no user is found
	ErrNoUser = fmt.Errorf("no matching user")
)

Functions

func SyncOpt

func SyncOpt(sync ykval.SyncValue) func(auth *YKAuth)

SyncOpt set the internal sync level

func TimeoutOpt

func TimeoutOpt(timeout int) func(*YKAuth)

TimeoutOpt set the internal timeout

func VerifyPassword

func VerifyPassword(password, hash string) bool

VerifyPassword checks a password against its potential hash

Types

type Authentifier

type Authentifier interface {
	Authenticate(name, password, otp string) error
}

Authentifier is an interface abstracting the Authenticate process

type AuthentifierFunc

type AuthentifierFunc func(name, otp, password string) error

AuthentifierFunc is a wrapper for a function to implement the Authentifier interface

func (AuthentifierFunc) Authenticate

func (af AuthentifierFunc) Authenticate(name, otp, password string) error

Authenticate wraps a function to implement Authentifier interface

type Authorizer

type Authorizer interface {
	Authorize(name, otp string) error
}

Authorizer is an interface abstracting the Authorizer process

type AuthorizerFunc

type AuthorizerFunc func(name, otp string) error

AuthorizerFunc is a wrapper for a function to implement the Authorizer interface

func (AuthorizerFunc) Authorize

func (af AuthorizerFunc) Authorize(name, otp string) error

Authorize wraps a function to implement Authorizer interface

type YKAuth

type YKAuth struct {
	zerolog.Logger
	ykval.Verifier
	yubico.UserLoader
	*yubico.Client
	NonceFunc func(int) (string, error)
	// contains filtered or unexported fields
}

YKAuth is the base structure responsible for handling YKAuth flow

func NewYKAuth

func NewYKAuth(client *yubico.Client, options ...func(*YKAuth)) *YKAuth

NewYKAuth creates a new YKAuth instance

func (*YKAuth) Authenticate

func (y *YKAuth) Authenticate(name, password, otp string) error

Authenticate tries to authenticate a user with password + otp

func (*YKAuth) Authorize

func (y *YKAuth) Authorize(name, otp string) error

Authorize tries to authorize a user given its name and otp

Jump to

Keyboard shortcuts

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