authen

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MPL-2.0 Imports: 11 Imported by: 0

README

Authentication Enhancement

A service for adding 2FA and tickets to an existing authentication flow. See the documentation for more information on what it does and how to use it.

Development

Requires Go (1.18+), PostgreSQL and CockroachDB. Use make t to run all tests. We don't use Docker because its startup/teardown time is noticeable enough to be annoying when quickly iterating (though of course, you can use what you want).

You can set the GOBL_TEST_PG and GOBL_TEST_CR environment variables to the full postgres and cockroach connection URLs, they default to: postgres://localhost:5432 and postgres://root@localhost:26257 respectively. A gobl_test database will automatically be created.

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Init

func Init(config config.Config) error

Types

type Env

type Env struct {

	// Reference to the project
	Project *Project

	// Anything logged with this logger will automatically have the pid (project id)
	// and rid (request id) fields
	Logger log.Logger

	// records validation errors
	Validator *validation.Result
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv(p *Project) *Env

func (*Env) Error

func (e *Env) Error(ctx string) log.Logger

func (*Env) Fatal

func (e *Env) Fatal(ctx string) log.Logger

func (*Env) Info

func (e *Env) Info(ctx string) log.Logger

func (*Env) Release

func (e *Env) Release()

func (*Env) RequestId

func (e *Env) RequestId() string

func (*Env) Warn

func (e *Env) Warn(ctx string) log.Logger

type EnvBuilder

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

func BuildEnv

func BuildEnv() *EnvBuilder

func (*EnvBuilder) Env

func (eb *EnvBuilder) Env() *Env

func (*EnvBuilder) LoginLogMax added in v0.0.2

func (eb *EnvBuilder) LoginLogMax(max int) *EnvBuilder

func (*EnvBuilder) LoginLogMaxPayloadLength added in v0.0.2

func (eb *EnvBuilder) LoginLogMaxPayloadLength(max int) *EnvBuilder

func (*EnvBuilder) ProjectId

func (eb *EnvBuilder) ProjectId(id string) *EnvBuilder

func (*EnvBuilder) TOTPMax

func (eb *EnvBuilder) TOTPMax(max int) *EnvBuilder

func (*EnvBuilder) TOTPSetupTTL

func (eb *EnvBuilder) TOTPSetupTTL(max int) *EnvBuilder

func (*EnvBuilder) TicketMax added in v0.0.2

func (eb *EnvBuilder) TicketMax(max int) *EnvBuilder

func (*EnvBuilder) TicketMaxPayloadLength added in v0.0.2

func (eb *EnvBuilder) TicketMaxPayloadLength(max int) *EnvBuilder

type Project

type Project struct {
	Id                       string
	TOTPMax                  int           `json:"totp_max"`
	TOTPIssuer               string        `json:"totp_issuer"`
	TOTPSetupTTL             time.Duration `json:"totp_setup_ttl"`
	TOTPSecretLength         int           `json:"totp_secret_length"`
	TicketMax                int           `json:"ticket_max"`
	TicketMaxPayloadLength   int           `json:"ticket_max_payload_length"`
	LoginLogMax              int           `json:"login_log_max"`
	LoginLogMaxPayloadLength int           `json:"login_log_max_payload_length"`
	// contains filtered or unexported fields
}

A project instance isn't updated. If the project is changed, a new instance is created.

func NewProject

func NewProject(projectData *data.Project, logProjectId bool) *Project

func (*Project) NextRequestId

func (p *Project) NextRequestId() string

Directories

Path Synopsis
pg

Jump to

Keyboard shortcuts

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