auth

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

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

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

package auth provides authentication-related functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attrs

type Attrs map[string][]byte

func (Attrs) Bytes

func (a Attrs) Bytes() []byte

Bytes turns a into a byte slice of "key1=value,key2=value2,...", sorted by the key

type CA

type CA interface {
	Sign(Certificate) Certificate
}

type CapFlags

type CapFlags uint32

CapFlags specifies permission flags for the Capability.

Leaving the flags at 0 will remove all rights from that point onwards. For example, if person A has a grant with CapPermFull for

/.orgs/fi/some-company/some-team/*

putting a grant with CapFlags(0) at

/.orgs/fi/some-company/some-team/.identities/*

would mean A had otherwise full access to everything under /.orgs/fi/some-company/some-team/, except for the ./identities subfolder

const (
	CapPermCreate CapFlags = 1 << (4 - 1 - iota)
	CapPermRead
	CapPermUpdate
	CapPermDelete

	// CapPermFull gives full CRUD access
	CapPermFull CapFlags = 0xF
)

func (CapFlags) On

func (cf CapFlags) On(f CapFlags) bool

On checks that all the flags in f are all on in cf

func (CapFlags) Set

func (cf CapFlags) Set(fs ...CapFlags)

Set flags fs on cf

func (CapFlags) String

func (cf CapFlags) String() string

type Capability

type Capability struct {
	Path string
	CapFlags
}

A Capability gives access to something according to a path and permission flags.

type Certificate

type Certificate interface {
	common.Hashable
	PublicKey() sign.PublicKey
	Attributes() Attrs
	// Subject returns the subject this certificate covers. Must be a / separated path. Example:
	//  /identity/
	// Subject() string // TODO: get everything from Attributes?
	Fingerprint() sign.Fingerprint
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

type Grant

type Grant struct {
	Certificate
	Capability
}

Grants give Identities Capabilities

type Identity

type Identity interface {
	Certificate
	Name() string
	Metadata() map[string][]byte
	Grants() []Grant
}

Jump to

Keyboard shortcuts

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