accessctl

package
v0.2012.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package accessctl implements access control for an Oasis node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is an access control action.

type Policy

type Policy map[Action]map[Subject]bool

Policy maps from Actions to a mapping from Subjects to booleans indicating whether the given subject is allowed to perform the given action or not.

The policy is not safe for concurrent use.

func NewPolicy

func NewPolicy() Policy

NewPolicy returns an empty policy.

func (Policy) Allow

func (p Policy) Allow(sub Subject, act Action)

Allow adds a policy rule that allows the given Subject to perform the given Action.

func (Policy) Deny

func (p Policy) Deny(sub Subject, act Action)

Deny removes a policy rule that allows the given Subject to perform the given Action.

func (Policy) IsAllowed

func (p Policy) IsAllowed(sub Subject, act Action) bool

IsAllowed returns a boolean indicating whether the given Subject is allowed to perform the given Action under the current Policy.

func (Policy) String

func (p Policy) String() string

String returns the string representation of the policy.

type Subject

type Subject string

Subject is an access control subject.

func SubjectFromPublicKey

func SubjectFromPublicKey(pubKey signature.PublicKey) Subject

SubjectFromPublicKey returns a Subject from the given public key.

func SubjectFromX509Certificate

func SubjectFromX509Certificate(cert *x509.Certificate) Subject

SubjectFromX509Certificate returns a Subject from the given X.509 certificate.

Jump to

Keyboard shortcuts

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