basculechecks

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CapabilityKey = "capabilities"
	PartnerKey    = "allowedResources.allowedPartners"
)
View Source
const (
	OutcomeLabel   = "outcome"
	ReasonLabel    = "reason"
	ClientIDLabel  = "clientid"
	EndpointLabel  = "endpoint"
	PartnerIDLabel = "partnerid"
)

labels

View Source
const (
	RejectedOutcome = "rejected"
	AcceptedOutcome = "accepted"
	// reasons
	TokenMissing             = "auth_missing"
	UndeterminedPartnerID    = "undetermined_partner_ID"
	UndeterminedCapabilities = "undetermined_capabilities"
	EmptyCapabilitiesList    = "empty_capabilities_list"
	NoCapabilitiesMatch      = "no_capabilities_match"
)

outcomes

View Source
const (
	AuthCapabilityCheckOutcome = "auth_capability_check"
)

Names for our metrics

Variables

View Source
var (
	ErrNoVals                 = errors.New("expected at least one value")
	ErrNoAuth                 = errors.New("couldn't get request info: authorization not found")
	ErrNonstringVal           = errors.New("expected value to be a string")
	ErrNoValidCapabilityFound = errors.New("no valid capability for endpoint")
	ErrNilAttributes          = fmt.Errorf("nil attributes interface")
)

Functions

func Metrics

func Metrics() []xmetrics.Metric

Metrics returns the Metrics relevant to this package

func NewCapabilityChecker added in v1.6.2

func NewCapabilityChecker(m *AuthCapabilityCheckMeasures, prefix string, acceptAllMethod string, endpoints []*regexp.Regexp) (*capabilityCheck, error)

NewCapabilityChecker creates an object that produces a check on capabilities in bascule tokens, to be run by the bascule enforcer middleware.

func NewCapabilityCheckerFromStrings added in v1.10.2

func NewCapabilityCheckerFromStrings(m *AuthCapabilityCheckMeasures, prefix string, acceptAllMethod string, endpoints []string, logger log.Logger) (*capabilityCheck, error)

NewCapabilityCheckerFromStrings creates the capability checker, and allows consumers to provide a list of string endpoints to be compiled into regular expressions. Only expressions that compile successfully are included in the checker.

func ProvideMetrics added in v1.10.2

func ProvideMetrics() fx.Option

Types

type AuthCapabilityCheckMeasures added in v1.6.2

type AuthCapabilityCheckMeasures struct {
	fx.In

	CapabilityCheckOutcome metrics.Counter `name:"auth_capability_check"`
}

AuthCapabilityCheckMeasures describes the defined metrics that will be used by clients

func NewAuthCapabilityCheckMeasures added in v1.6.2

func NewAuthCapabilityCheckMeasures(p provider.Provider) *AuthCapabilityCheckMeasures

NewAuthCapabilityCheckMeasures realizes desired metrics

Jump to

Keyboard shortcuts

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