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.
Click to show internal directories.
Click to hide internal directories.