client

package
v0.0.0-...-3e0f7d7 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c []config.Client)

New initiate client slice based on the []config.Client slice

func NewContext

func NewContext(ctx context.Context, serialId *big.Int) context.Context

NewContext store user in ctx and return new ctx.

Types

type Client

type Client struct {
	Serial string
	Scopes []Scope
}

Client serial and scopes to determine if certain client can access certain method

func FromContext

func FromContext(ctx context.Context) (*Client, bool)

FromContext returns the User stored in ctx, if any.

func GetClient

func GetClient(serialId string) (*Client, error)

GetClient return client based on provided serialId

type Scope

type Scope string

Scope represents the level of access to various methods

const (
	// WildcardScope represents access to all methods
	WildcardScope Scope = "WILDCARD"
	// PublicScope represents access to all public methods
	PublicScope Scope = "PUBLIC"
	// WriteScope represents access to all write methods
	WriteScope Scope = "WRITE"
	// ReadScope represents access to all read methods
	ReadScope Scope = "READ"
)

Jump to

Keyboard shortcuts

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