authentication

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Admin = iota // Reader + Writer + register auth
	Reader
	Writer
)

auth role

Variables

This section is empty.

Functions

func Authentication

func Authentication() gin.HandlerFunc

func GetAuthRoleIntFromStr

func GetAuthRoleIntFromStr(str string) int

Types

type AuthCancelOption

type AuthCancelOption struct {
	ParentUser string // parent's username (role should be 'Admin')
	Username   string
}

type AuthCenter

type AuthCenter struct {
	// contains filtered or unexported fields
}

func GetAuthCenter

func GetAuthCenter() *AuthCenter

func NewAuthCenter

func NewAuthCenter(option *AuthCenterOption) *AuthCenter

func (*AuthCenter) Cancel

func (a *AuthCenter) Cancel(option *AuthCancelOption) error

func (*AuthCenter) GetReaders

func (a *AuthCenter) GetReaders() map[string]string

func (*AuthCenter) GetWriters

func (a *AuthCenter) GetWriters() map[string]string

func (*AuthCenter) Register

func (a *AuthCenter) Register(option *AuthRegisterOption) error

type AuthCenterOption

type AuthCenterOption struct {
	Username string
	Password string
}

type AuthRegisterOption

type AuthRegisterOption struct {
	ParentUser string // parent's username (role should be 'Admin')
	Username   string
	Password   string
	Role       int
}

type WareAuthOption

type WareAuthOption struct {
	Open bool `yaml:"Open"`
	Root struct {
		Username string `yaml:"Username"`
		Password string `yaml:"Password"`
	} `yaml:"Root"`
	Others []struct {
		Username string `yaml:"Username"`
		Password string `yaml:"Password"`
		Role     string `yaml:"Role"`
	} `yaml:"Others"`
}

func DefaultOption

func DefaultOption() *WareAuthOption

type WareUser

type WareUser struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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