auth

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator struct {
	Config *Config
	// contains filtered or unexported fields
}

An Authenticator contains a list of authenticated web UI sessions and exposes a few functions for authenticating users and generating tokens.

func New

func New(config *Config) *Authenticator

New returns a new Authenticator instance and spins up a goroutine that handles expiring sessions

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(w http.ResponseWriter, r *http.Request) (bool, error)

Authenticate logs in the client if the request contains a token and checks whether the current request is authenticated.

func (*Authenticator) ExpireClients

func (a *Authenticator) ExpireClients()

ExpireClients expires all sessions that have been logged in for 48+ hours.

func (*Authenticator) GetToken

func (a *Authenticator) GetToken() (string, error)

GetToken generates a TOTP token that is valid for 30 seconds.

type Client

type Client struct {
	UUID  string
	Added time.Time
}

A Client is an authenticated web UI session

type Config

type Config struct {
	Token string
	Log   *log.Log
}

Config contains the config options for the TOTP authentication serivce that is used for the web UI.

Jump to

Keyboard shortcuts

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