Documentation ¶
Overview ¶
Package credentials includes validators for the credentials provided for KongConsumers.
Index ¶
Constants ¶
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 ¶
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 ¶
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 ¶
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.