guard

package
v0.0.0-...-52aaef3 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2015 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidCredentialsFormat        = errors.New("Invalid credentials format")
	InvalidCredentials              = errors.New("Invalid credentials")
	UnableRetrieveUser              = errors.New("Unable to retrieve the user")
	CredentialMismatch              = errors.New("Credential mismatch")
	AuthenticatedTokenCreationError = errors.New("Unable to create authentication token")
)

Functions

func ConfigureServer

func ConfigureServer(l *goapp.Lifecycle, conf *config.ServerConfig)

func GetGuardMiddleware

func GetGuardMiddleware(auths []GuardAuthenticator) func(c *web.C, h http.Handler) http.Handler

Types

type DefaultGuardToken

type DefaultGuardToken struct {
	Username string
	Roles    []string
}

Default implementation to the GuardToken

func (*DefaultGuardToken) GetRoles

func (t *DefaultGuardToken) GetRoles() []string

func (*DefaultGuardToken) GetUsername

func (t *DefaultGuardToken) GetUsername() string

type DefaultGuardUser

type DefaultGuardUser struct {
	Username string
	Password string
	Roles    []string
}

func (*DefaultGuardUser) GetPassword

func (u *DefaultGuardUser) GetPassword() string

func (*DefaultGuardUser) GetRoles

func (u *DefaultGuardUser) GetRoles() []string

func (*DefaultGuardUser) GetUsername

func (u *DefaultGuardUser) GetUsername() string

type GuardAuthenticator

type GuardAuthenticator interface {
	// contains filtered or unexported methods
}

type GuardToken

type GuardToken interface {
	// return the current username for the current token
	GetUsername() string

	// return the related roles linked to the current token
	GetRoles() []string
}

Bare interface to used inside a request lifecycle

type GuardUser

type GuardUser interface {
	GetUsername() string
	GetPassword() string
	GetRoles() []string
}

Bare interface with the default requirement to check username and password

type JwtLoginGuardAuthenticator

type JwtLoginGuardAuthenticator struct {
	LoginPath   string
	NodeManager core.NodeManager
	Validity    int64
	Key         []byte
}

this authenticator will create a JWT Token from a standard form

type JwtToken

type JwtToken struct {
	User  *core.Reference `json:"user"`
	Key   []byte          `json:"key"`
	Roles []string        `json:"roles"`
}

type JwtTokenGuardAuthenticator

type JwtTokenGuardAuthenticator struct {
	Path        *regexp.Regexp
	NodeManager core.NodeManager
	Validity    int64
	Key         []byte
}

this authenticator will create a JWT Token from a standard form

type JwtTokenMeta

type JwtTokenMeta struct {
	Expiration time.Time `json:"expiration"`
}

type JwtTokentHandler

type JwtTokentHandler struct {
}

func (*JwtTokentHandler) GetDownloadData

func (h *JwtTokentHandler) GetDownloadData(node *core.Node) *core.DownloadData

func (*JwtTokentHandler) GetStruct

func (h *JwtTokentHandler) GetStruct() (core.NodeData, core.NodeMeta)

func (*JwtTokentHandler) Load

func (h *JwtTokentHandler) Load(data []byte, meta []byte, node *core.Node) error

func (*JwtTokentHandler) PostInsert

func (h *JwtTokentHandler) PostInsert(node *core.Node, m core.NodeManager) error

func (*JwtTokentHandler) PostUpdate

func (h *JwtTokentHandler) PostUpdate(node *core.Node, m core.NodeManager) error

func (*JwtTokentHandler) PreInsert

func (h *JwtTokentHandler) PreInsert(node *core.Node, m core.NodeManager) error

func (*JwtTokentHandler) PreUpdate

func (h *JwtTokentHandler) PreUpdate(node *core.Node, m core.NodeManager) error

func (*JwtTokentHandler) StoreStream

func (h *JwtTokentHandler) StoreStream(node *core.Node, r io.Reader) (int64, error)

func (*JwtTokentHandler) Validate

func (h *JwtTokentHandler) Validate(node *core.Node, m core.NodeManager, errors core.Errors)

type MockedAuthenticator

type MockedAuthenticator struct {
	mock.Mock
}

Jump to

Keyboard shortcuts

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