X2fa

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FirstRequest bool = true

============================================================================================================================================

View Source
var LastResut []byte
View Source
var ThisEpoc int
View Source
var TimeRemain int

Functions

func DoGet

func DoGet(uri string, args ...string) (status int, rv string)

Modified to send Header!

--------------------------------------------- // Xyzzy101 - Setup QR Redirect ---------------------------------------------

export QR_SHORT_AUTH_TOKEN="w4h0wvtb1zk4uf8Xv.Ns9Q7j8"
wget -o out/,list1 -O out/,list2 \
	--header "X-Qr-Auth: ${QR_SHORT_AUTH_TOKEN}" \
	"http://t432z.com/upd/?url=http://test.test.com&id=5c"

-- 1. DoGet - change to create a header
-- 2. Example Call to set this

func GenRandBytes

func GenRandBytes(nRandBytes int) (buf []byte, err error)

============================================================================================================================================ Should move to aesccm package

func GenRandBytesOracle

func GenRandBytesOracle() (buf []byte, ttl, epoc int, err error)

============================================================================================================================================ Should move to aesccm package

func GenRandNumber

func GenRandNumber(nDigits int) (buf string, err error)

Generate a random number, 0..N, returned as a string with 6 to 8 non-zero digits.

func IsValid2fa

func IsValid2fa(hdlr *X2faType, rw *goftlmux.MidBuffer, www http.ResponseWriter, req *http.Request, mdata map[string]string)

Return 200 if it is a valid 2fa - this will be disabled when not testing.

Types

type RanData

type RanData struct {
	Status string `json:"status"`
	Value  string `json:"value"`
	TTL    int    `json:"ttl"`
	Epoc   int    `json:"ep"`
}

type RedisData

type RedisData struct {
	Hash   string   `json:"hash"`
	Fp     []string `json:"fp"`
	T2faID string   `json:"t_2fa_id"`
	UserID string   `json:"user_id"`
	URL    string   `json:"URL"`
}

type X2faType

type X2faType struct {
	Next         http.Handler //
	Paths        []string     //
	RedisPrefix  string       //
	TemplatePath string       //	1stRedirct.tmpl
	QRPath       string       //
	QRURLPath    string       //
	DisplayURL   string       // URL of the 2fa Appliation
	TimeoutCodes int          // duration for a hash value stored in redis (2-min hash) - how long a "code" is valid for. In seconds.
	AuthKey      string       //
	Server2faURL string       // http://t432z.com

	LineNo int //
	// contains filtered or unexported fields
}

func NewX2faTypeServer

func NewX2faTypeServer(n http.Handler, p []string, redisPrefix, realm string) *X2faType

NewX2faTypeServer will create a copy of the server for testing.

func (*X2faType) Get2MinHashFunc

func (hdlr *X2faType) Get2MinHashFunc() (hash string, ttlLeft int, err error)

func (*X2faType) GetPerDeviceHash

func (hdlr *X2faType) GetPerDeviceHash(user_id, t2faId string) (user_hash, fp string, err error)

------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------

func (*X2faType) GetUserIDFromAuthToken

func (hdlr *X2faType) GetUserIDFromAuthToken(auth_token string) (user_id string, err error)

------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------

func (*X2faType) GetValidList

func (hdlr *X2faType) GetValidList(user_id string) (list []string, err error)

------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------ GetValidList get list of convened to string int values for valid 2fa

func (*X2faType) InitializeWithConfigData

func (hdlr *X2faType) InitializeWithConfigData(next http.Handler, gCfg *cfg.ServerGlobalConfigType, serverName string, pNo, callNo int) (err error)

func (*X2faType) PreValidate

func (hdlr *X2faType) PreValidate(gCfg *cfg.ServerGlobalConfigType, cfgData map[string]interface{}, serverName string, pNo, callNo int) (err error)

func (*X2faType) PullQRFromDB

func (hdlr *X2faType) PullQRFromDB(tag string) (qr_enc_id string, err error)

err = hdlr.PullQRFromDB(rr.Tag)

func (*X2faType) PullQRURLFromDB

func (hdlr *X2faType) PullQRURLFromDB() (qr_enc_id, qr_url string, err error)

err = hdlr.PullQRFromDB(rr.Tag)

func (*X2faType) ServeHTTP

func (hdlr *X2faType) ServeHTTP(www http.ResponseWriter, req *http.Request)

func (*X2faType) UpdateQRMarkAsUsed

func (hdlr *X2faType) UpdateQRMarkAsUsed(qrId string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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