auth

package
v0.0.0-...-7fa8e96 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredentials = errors.New("invalid authentication credentials")
	ErrInvalidOrgId       = errors.New("invalid orgId")
	ErrInvalidInstanceID  = errors.New("invalid instanceID")
	ErrInvalidRole        = errors.New("invalid authentication credentials, role unable to publish")

	AdminKey  string
	AdminUser = &User{
		ID:      1,
		IsAdmin: true,
		Role:    gcom.ROLE_ADMIN,
	}
)

Functions

This section is empty.

Types

type AuthPlugin

type AuthPlugin interface {
	// Auth returns whether a api_key is a valid and if the user has access to a certain instance
	Auth(username, password string) (*User, error)
	Stop()
}

AuthPlugin is used to validate access

func GetAuthPlugin

func GetAuthPlugin(name string) AuthPlugin

type FileAuth

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

Reads an ini file containing a section for each auth Key. Each section contains the user details associated with that key.

example: ------------------ [aaeipgnq] orgId = 1 isAdmin = true

[wpirgn123] orgId = 23 isAdmin = false instances = 1,2,4 -------------------

func NewFileAuth

func NewFileAuth() *FileAuth

func (*FileAuth) Auth

func (a *FileAuth) Auth(instanceID, password string) (*User, error)

func (*FileAuth) Stop

func (a *FileAuth) Stop()

type GrafanaComAuth

type GrafanaComAuth struct{}

func NewGrafanaComAuth

func NewGrafanaComAuth() *GrafanaComAuth

func (*GrafanaComAuth) Auth

func (a *GrafanaComAuth) Auth(username, password string) (*User, error)

func (*GrafanaComAuth) Stop

func (a *GrafanaComAuth) Stop()

type GrafanaComInstanceAuth

type GrafanaComInstanceAuth struct{}

func NewGrafanaComInstanceAuth

func NewGrafanaComInstanceAuth() *GrafanaComInstanceAuth

func (*GrafanaComInstanceAuth) Auth

func (a *GrafanaComInstanceAuth) Auth(username, password string) (*User, error)

func (*GrafanaComInstanceAuth) Stop

func (a *GrafanaComInstanceAuth) Stop()

type User

type User struct {
	ID      int
	IsAdmin bool
	Role    gcom.RoleType
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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