credentials

package
v2.0.6 Latest Latest
Warning

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

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

Documentation

Overview

Package credentials includes validators for the credentials provided for KongConsumers.

Index

Constants

View Source
const TypeKey = "kongCredType"

TypeKey indicates the key in a consumer secret which identifies the type of credential that is being provided for the consumer.

Variables

View Source
var SupportedTypes = sets.NewString(
	"basic-auth",
	"hmac-auth",
	"jwt",
	"key-auth",
	"oauth2",
	"acl",
)

SupportedCreds indicates all the "kongCredType"s which are supported for KongConsumer credentials.

Functions

func IsKeyUniqueConstrained

func IsKeyUniqueConstrained(keyType, key string) (constrained bool)

IsKeyUniqueConstrained indicates whether or not a given key and its type there are unique constraints in place.

Types

type Credential

type Credential struct {
	// ConsumerName indicates the name of the KongConsumer which this credential
	// is supplied for.
	ConsumerName string

	// ConsumerNamespace indicates the namespace that the KongConsumer which this
	// credential is supplied for.
	ConsumerNamespace string

	// Type indicates the credential type, which will reference one of the types
	// in the SupportedTypes set.
	Type string

	// Key is the key for the credentials data
	Key string

	// Value is the data provided for the key
	Value string
}

Credential is a metadata struct to help validate the contents of consumer credentials, particularly unique constraints on the underlying data.

type Index

type Index map[string]map[string]map[string]struct{}

Index is a map of credentials types to a map of credential keys to the underlying values already seen for that type and key. This type is used as a history tracker for validation so that callers can keep track of the credentials they've seen thus far and validate whether new credentials they encounter are in violation of any constraints on their respective types.

func (Index) Add

func (cs Index) Add(newCred Credential) error

Add will attempt to add a new Credential to the CredentialsTypeMap. If that new credential is in violation of any constraints based on the credentials already stored in the map, an error will be thrown.

Jump to

Keyboard shortcuts

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