otp

package
v2.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package otp allows authentication through a one time password instead of a traditional password.

Index

Constants

View Source
const (

	// PageLogin is for identifying the login page for parsing & validation
	PageLogin = "otplogin"
	// PageAdd is for adding an otp to the user
	PageAdd = "otpadd"
	// PageClear is for deleting all the otps from the user
	PageClear = "otpclear"

	// DataNumberOTPs shows the number of otps for add/clear operations
	DataNumberOTPs = "otp_count"
	// DataOTP shows the new otp that was added
	DataOTP = "otp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OTP

type OTP struct {
	*authboss.Authboss
}

OTP module

func (*OTP) AddGet

func (o *OTP) AddGet(w http.ResponseWriter, r *http.Request) error

AddGet shows how many passwords exist and allows the user to create a new one

func (*OTP) AddPost

func (o *OTP) AddPost(w http.ResponseWriter, r *http.Request) error

AddPost adds a new password to the user and displays it

func (*OTP) ClearGet

func (o *OTP) ClearGet(w http.ResponseWriter, r *http.Request) error

ClearGet shows how many passwords exist and allows the user to clear them all

func (*OTP) ClearPost

func (o *OTP) ClearPost(w http.ResponseWriter, r *http.Request) error

ClearPost clears all otps that are stored for the user.

func (*OTP) Init

func (o *OTP) Init(ab *authboss.Authboss) (err error)

Init module

func (*OTP) LoginGet

func (o *OTP) LoginGet(w http.ResponseWriter, r *http.Request) error

LoginGet simply displays the login form

func (*OTP) LoginPost

func (o *OTP) LoginPost(w http.ResponseWriter, r *http.Request) error

LoginPost attempts to validate the credentials passed in to log in a user.

type User

type User interface {
	authboss.User

	// GetOTPs retrieves a string of comma separated bcrypt'd one time passwords
	GetOTPs() string
	// PutOTPs puts a string of comma separated bcrypt'd one time passwords
	PutOTPs(string)
}

User for one time passwords

func MustBeOTPable

func MustBeOTPable(user authboss.User) User

MustBeOTPable ensures the user can use one time passwords

Source Files

  • otp.go

Directories

Path Synopsis
Package twofactor allows authentication via one time passwords
Package twofactor allows authentication via one time passwords
sms2fa
Package sms2fa implements two factor auth using sms-transmitted one time passwords.
Package sms2fa implements two factor auth using sms-transmitted one time passwords.
totp2fa
Package totp2fa implements two factor auth using time-based one time passwords.
Package totp2fa implements two factor auth using time-based one time passwords.

Jump to

Keyboard shortcuts

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