conventions

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2019 License: BSD-3-Clause Imports: 5 Imported by: 21

Documentation

Overview

Package conventions implements unenforced conventions for Vanadium.

This is still work in progress, the conventions may change. Please do not rely on these conventions till this comment is removed!

Package conventions implements unenforced conventions for Vanadium.

Index

Constants

View Source
const (
	ServerUser          = "self:?:ServerUser"      // a client that has our public key
	UnauthenticatedUser = "self:?:Unauthenticated" // a client which presents no blessing we trust
)

Special case user ids. They all have the identity provider "self" meaning that the server is poviding the identity and type "?" meaning that we don't know what type of Id this is.

Variables

This section is empty.

Functions

func GetClientUserIds

func GetClientUserIds(ctx *context.T, call security.Call) []string

GetClientUserIds returns a slice of ids for the client. Each Id is one of the special ones above or the string <identity provider>:<single letter type>:<actor>. Examples of types are "u" for user and "r" for role and "?" for unknown.

func ParseUserId

func ParseUserId(s string) []string

Parse the userId components from a blessing name or a userId string. Returns nil on failure.

Types

type Blessing

type Blessing struct {
	IdentityProvider string // Name of the identity provider
	User             string // UserID attested to by the identity provider
	Application      string // ApplicationID attested to by the identity provider (may be empty)
	Rest             string // Remaining extensions of the blessing.
}

Blessing represents structured information encoded in a blessing name.

func ParseBlessingNames

func ParseBlessingNames(blessingNames ...string) []Blessing

ParseBlessingNames extracts structured information from the provided blessing names. Blessing names that do not adhere to the conventions of this package are ignored.

Typically the set of names to provide would be obtained via a call to security.RemoteBlessingNames or security.LocalBlessingNames.

func (*Blessing) AppPattern

func (b *Blessing) AppPattern() security.BlessingPattern

AppPattern returns a BlessingPattern that would be matched by all users of the same application.

func (*Blessing) AppUserPattern

func (b *Blessing) AppUserPattern() security.BlessingPattern

AppUserPattern returns a BlessingPattern that would be matched by a blessing for the user using the same application.

func (*Blessing) Home

func (b *Blessing) Home() string

Home returns the "Home directory" in the global namespace for this Blessing.

func (*Blessing) String

func (b *Blessing) String() string

String returns the blessing name represented by this structure.

func (*Blessing) UserPattern

func (b *Blessing) UserPattern() security.BlessingPattern

UserPattern returns a BlessingPattern that would be matched by a blessing obtainable by the user (irrespective of application).

Jump to

Keyboard shortcuts

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