secure

package
v0.0.0-...-2f55915 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnauthorizedError = c2.NewErrC("unauthorized", 401)

Functions

func Manage

func Manage(rbac *Rbac) node.Node

Types

type AccessControl

type AccessControl struct {
	Path        string
	Permissions Permission
}

type Auth

type Auth interface {
	ConstrainRoot(role string, c *node.Constraints)
}

type Cert

type Cert struct {
	PrivateKey *rsa.PrivateKey
	Cert       *x509.Certificate
	Raw        []byte
}

func Decode

func Decode(inKey io.Reader, inCert io.Reader) (*Cert, error)

func (*Cert) EncodeCert

func (self *Cert) EncodeCert(out io.Writer) error

func (*Cert) EncodeKey

func (self *Cert) EncodeKey(out io.Writer) error

type CertHandler

type CertHandler struct {
	Authority *stock.Tls
}

func (*CertHandler) VerifyRequest

func (self *CertHandler) VerifyRequest(certs []*x509.Certificate) error

type Generator

type Generator struct {
	Country      string
	Organization string
}

func (*Generator) CA

func (self *Generator) CA() (*Cert, error)

func (*Generator) Cert

func (self *Generator) Cert(parent *Cert) (*Cert, error)

type Permission

type Permission int
const (
	None Permission = iota
	Read
	Full
)

type Rbac

type Rbac struct {
	Roles map[string]*Role
}

This does not implement NETMOD ACLs, but rather a simplistic implementation to be both useful and example of more complex implementations

func NewRbac

func NewRbac() *Rbac

func (*Rbac) ConstrainRoot

func (self *Rbac) ConstrainRoot(role string, c *node.Constraints)

type Role

type Role struct {
	Id     string
	Access map[string]*AccessControl
}

func NewRole

func NewRole() *Role

func (*Role) CheckActionPreConstraints

func (self *Role) CheckActionPreConstraints(r *node.ActionRequest) (bool, error)

func (*Role) CheckContainerPreConstraints

func (self *Role) CheckContainerPreConstraints(r *node.ChildRequest) (bool, error)

func (*Role) CheckFieldPreConstraints

func (self *Role) CheckFieldPreConstraints(r *node.FieldRequest, hnd *node.ValueHandle) (bool, error)

func (*Role) CheckListPreConstraints

func (self *Role) CheckListPreConstraints(r *node.ListRequest) (bool, error)

func (*Role) CheckNotifyFilterConstraints

func (self *Role) CheckNotifyFilterConstraints(msg node.Selection) (bool, error)

func (*Role) ContextConstraint

func (self *Role) ContextConstraint(s node.Selection) context.Context

Jump to

Keyboard shortcuts

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