auth

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: Apache-2.0 Imports: 3 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, provider Provider) error

Register auth provider

func UnRegister

func UnRegister(name string)

UnRegister authenticator

Types

type AccessType

type AccessType int

AccessType acl type

const (
	AccessTypeRead  AccessType = 1
	AccessTypeWrite            = 2
)

nolint: golint

func (AccessType) Type

func (t AccessType) Type() string

Type return string representation of the type

type Error

type Error int

Error auth provider errors

const (
	ErrInvalidArgs Error = iota
	ErrUnknownProvider
	ErrAlreadyExists
	ErrNotFound
	ErrNotOpen
	ErrInternal
)

nolint: golint

func (Error) Error

func (e Error) Error() string

type Manager

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

Manager auth

func NewManager

func NewManager(p string) (*Manager, error)

NewManager new auth manager

func (*Manager) ACL

func (m *Manager) ACL(clientID, user, topic string, access AccessType) Status

ACL check permissions

func (*Manager) Password

func (m *Manager) Password(user, password string) Status

Password authentication

type Provider

type Provider interface {
	// Password try authenticate with username and password
	Password(string, string) Status
	// ACL check access type for client id with username
	ACL(id string, username string, topic string, accessType AccessType) Status
}

Provider interface

type SessionPermissions

type SessionPermissions interface {
	ACL(id string, username string, topic string, accessType AccessType) Status
}

SessionPermissions check session permissions

type Status

type Status int

Status auth

const (
	StatusAllow Status = 0
	StatusDeny         = 1
)

nolint: golint

func (Status) Error

func (e Status) Error() string

Jump to

Keyboard shortcuts

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