basculechecks

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JWTValidationReasonCounter = "jwt_validation_reason"
	NBFHistogram               = "jwt_from_nbf_seconds"
	EXPHistogram               = "jwt_from_exp_seconds"
)

Names for our metrics

View Source
const (
	ReasonLabel = "reason"
)

labels

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")
	ErrEmptyString            = errors.New("expected string to be nonempty")
	ErrNoValidCapabilityFound = errors.New("no valid capability for endpoint")
)

Functions

func CreateValidCapabilityCheck

func CreateValidCapabilityCheck(config CapabilityConfig) func(context.Context, []interface{}) error

func Metrics

func Metrics() []xmetrics.Metric

Metrics returns the Metrics relevant to this package

Types

type CapabilityConfig

type CapabilityConfig struct {
	FirstPiece      string
	SecondPiece     string
	ThirdPiece      string
	AcceptAllMethod string
}

type JWTValidationMeasures

type JWTValidationMeasures struct {
	NBFHistogram     *gokitprometheus.Histogram
	ExpHistogram     *gokitprometheus.Histogram
	ValidationReason metrics.Counter
}

JWTValidationMeasures describes the defined metrics that will be used by clients

func NewJWTValidationMeasures

func NewJWTValidationMeasures(r xmetrics.Registry) *JWTValidationMeasures

NewJWTValidationMeasures realizes desired metrics

type MetricListener

type MetricListener struct {
	// contains filtered or unexported fields
}

func NewMetricListener

func NewMetricListener(m *JWTValidationMeasures, options ...Option) *MetricListener

func (*MetricListener) OnAuthenticated

func (m *MetricListener) OnAuthenticated(auth bascule.Authentication)

func (*MetricListener) OnErrorResponse

func (m *MetricListener) OnErrorResponse(e basculehttp.ErrorResponseReason, _ error)

type Option

type Option func(m *MetricListener)

func WithExpLeeway

func WithExpLeeway(e time.Duration) Option

func WithNbfLeeway

func WithNbfLeeway(n time.Duration) Option

Jump to

Keyboard shortcuts

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