auth

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package auth provides you functions that let you work with auth. All state is stored in-package. The password is stored hashed, so safe enough.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizedFromRequest

func AuthorizedFromRequest(rq *http.Request) bool

AuthorizedFromRequest is true if the user is authorized.

func CredentialsMatch

func CredentialsMatch(name, pass string) bool

CredentialsMatch checks if the credentials match.

func Initialize

func Initialize()

Initialize queries the database for auth information. Call on startup. The module handles all further invocations for you.

func LogInResponse

func LogInResponse(w http.ResponseWriter)

LogInResponse logs such user in and writes a cookie for them.

func LogoutFromRequest

func LogoutFromRequest(w http.ResponseWriter, rq *http.Request)

LogoutFromRequest logs the user in the request out and rewrites the cookie in to an empty one.

func Ready

func Ready() bool

Ready returns if the admin account is set up. If it is not, Betula should demand it and refuse to work until then.

func SetCredentials

func SetCredentials(name, pass string)

SetCredentials sets new credentials.

Types

This section is empty.

Jump to

Keyboard shortcuts

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