auth

package
v0.0.0-...-e5515f0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: AGPL-3.0 Imports: 30 Imported by: 4

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 CheckLinkedAppInstalled

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

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

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.

Jump to

Keyboard shortcuts

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