auth

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package auth is for the abstraction of the authentication method. this enables the application developer to seperate the authentication from the authentication itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account interface {
	Get(constants.AccountConstant) any
	List() []constants.AccountConstant
	Anonymous() bool
	Redirect(c *gin.Context)
}

Account is an interface that gives the application access to infos about the user.

type AnonAccount

type AnonAccount struct{}

AnonAccount is an simple Account-interface implementation. It is always Anonymous

func (*AnonAccount) Anonymous

func (*AnonAccount) Anonymous() bool

Anonymous is always true

func (*AnonAccount) Get

func (*AnonAccount) Get(key constants.AccountConstant) (in any)

Get returns only AccountAnon = true

func (*AnonAccount) List

List return only AccountAnon as the only Listitem

func (*AnonAccount) Redirect

func (*AnonAccount) Redirect(c *gin.Context)

Redirect should point to an login, but since its not possible for this handler it sends an 401 Page

type AnonAccountHandler

type AnonAccountHandler struct{}

AnonAccountHandler is an simple struct that fullfills the AuthenticationHandler Interface

func (*AnonAccountHandler) Account

Account is an simple method that returns an Account that is always anonymous.

type AuthenticationHandler

type AuthenticationHandler interface {
	Account(*gin.Context) Account
}

AuthenticationHandler is an interface that is used to give the account of the request. it is set into the context using gin.Context.Set. The context must be reused for the redirect. Account NEVER returns nil. Not loggedin Users have return Anonymous() = true and get() = nil and List() = []string{}

Jump to

Keyboard shortcuts

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