auth

package
v0.0.0-...-4b98c26 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

Package auth provides register and login handlers

Index

Constants

View Source
const (
	// CredentialsErrorKey is the key for translating the message showed to the
	// user when he/she enters incorrect credentials
	CredentialsErrorKey = "Login Credentials error"
	// TwoFactorErrorKey is the key for translating the message showed to the
	// user when he/she enters incorrect two factor secret
	TwoFactorErrorKey = "Login Two factor error"
	// TwoFactorExceededErrorKey is the key for translating the message showed to the
	// user when there were too many attempts
	TwoFactorExceededErrorKey = "Login Two factor attempts error"
)

Variables

This section is empty.

Functions

func AppRedirection

func AppRedirection(inst *instance.Instance, redirect string) (*url.URL, error)

func CheckLinkedAppInstalled

func CheckLinkedAppInstalled(inst *instance.Instance, slug string) error

CheckLinkedAppInstalled checks if a linked webapp has been installed to the instance

func ConfirmSuccess

func ConfirmSuccess(c echo.Context, inst *instance.Instance, state string) error

ConfirmSuccess can be used to send a response after a successful identity confirmation.

func DiskInfo

func DiskInfo(fs vfs.VFS) (string, string, error)

DiskInfo returns the used and quota disk space for the given VFS.

func GetLinkedApp

func GetLinkedApp(instance *instance.Instance, softwareID string) (*app.WebappManifest, error)

GetLinkedApp fetches the app manifest on the registry

func Home

func Home(c echo.Context) error

Home is the handler for / It redirects to the login page is the user is not yet authentified Else, it redirects to its home application (or onboarding)

func LoginRateExceeded

func LoginRateExceeded(i *instance.Instance) error

LoginRateExceeded blocks the instance after too many failed attempts to login

func Routes

func Routes(router *echo.Group)

Routes sets the routing for the status service

func SetCookieForNewSession

func SetCookieForNewSession(c echo.Context, longRunSession bool) (string, error)

SetCookieForNewSession creates a new session and sets the cookie on echo context

func TwoFactorGenerationExceeded

func TwoFactorGenerationExceeded(i *instance.Instance) error

TwoFactorGenerationExceeded checks if there was too many attempts to regenerate a 2FA code within an hour

func TwoFactorRateExceeded

func TwoFactorRateExceeded(i *instance.Instance) error

TwoFactorRateExceeded regenerates a new 2FA passcode after too many failed attempts to login

Types

type AccessTokenReponse

type AccessTokenReponse struct {
	Type    string `json:"token_type"`
	Scope   string `json:"scope"`
	Access  string `json:"access_token"`
	Refresh string `json:"refresh_token,omitempty"`
}

AccessTokenReponse is the stuct used for serializing to JSON the response for an access token.

type Store

type Store interface {
	AddCode(db prefixer.Prefixer) (string, error)
	GetCode(db prefixer.Prefixer, code string) (bool, error)
}

Store is essentially an object to store and retrieve confirmation codes

func GetStore

func GetStore() Store

GetStore returns the store for temporary move objects.

Jump to

Keyboard shortcuts

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