clientcertvalidate

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCertificateRejectedError

type ClientCertificateRejectedError struct {
	// Subject field that did not match.
	Field string
	// Expected values given in the subject argument for the given field.
	Expected interface{}
	// Values found in the certificate subject field for the given field.
	Received interface{}
}

ClientCertificateRejectedError contains the details of the certificate rejection reason.

func (ClientCertificateRejectedError) Error

Error returns the string representation of the error.

type ClientCertificateSubjectPrefixType

type ClientCertificateSubjectPrefixType int

ClientCertificateSubjectPrefixType is the subject header type.

const (
	// ClientCertificateSubjectPrefixString is the s:/ header.
	ClientCertificateSubjectPrefixString ClientCertificateSubjectPrefixType = iota
	// ClientCertificateSubjectPrefixPattern is the r:/ header.
	ClientCertificateSubjectPrefixPattern
)

type InvalidPatternValueError

type InvalidPatternValueError struct {
	// Field in which the value is defined:
	Field string
	// Original error
	Reason error
	// Value which is problematic.
	Value string
}

InvalidPatternValueError contains the details of the certificate rejection reason.

func (InvalidPatternValueError) Error

func (e InvalidPatternValueError) Error() string

Error returns the string representation of the error.

type KVs

type KVs map[string][]string

KVs represents parsed key value client certificate subject.

type ParsedSubject

type ParsedSubject interface {
	KVs() KVs
	WithKVs(string, []string)
	Input() string
	RegexpKVs() RegexpKVs
	WithRegexpKVs(string, []*regexp.Regexp)
	Type() ClientCertificateSubjectPrefixType
	WithType(ClientCertificateSubjectPrefixType)
	X509Validate(*x509.Certificate) error
}

ParsedSubject is the result of the subject parser Parse() operation. Contains operations to validate its after parse state and validate the X509 Certificate.

func DefaultParsedSubject

func DefaultParsedSubject() ParsedSubject

DefaultParsedSubject returns an initialized instance of the default parsed subject implementation.

type ParserInvalidPrefixError

type ParserInvalidPrefixError struct {
	// Consumed invalid value
	ConsumedPrefix string
}

ParserInvalidPrefixError is returned when an unsupported prefix is consumed.

func (ParserInvalidPrefixError) Error

func (e ParserInvalidPrefixError) Error() string

Error returns the string representation of the error.

type ParserInvalidSubjectFieldError

type ParserInvalidSubjectFieldError struct {
	// Consumed string at the expected field position.
	ConsumedString string
}

ParserInvalidSubjectFieldError is an error returned when a string consumed at a field position unsupported is not a valid field string.

func (ParserInvalidSubjectFieldError) Error

Error returns the string representation of the error.

type ParserMissingPrefixError

type ParserMissingPrefixError struct {
	// Raw input.
	RawInput string
}

ParserMissingPrefixError is returned when an input string is missing a prefix.

func (ParserMissingPrefixError) Error

func (e ParserMissingPrefixError) Error() string

Error returns the string representation of the error.

type ParserUnexpectedError

type ParserUnexpectedError struct {
	// The unexpected raw cause.
	Unexpected error
}

ParserUnexpectedError is an error returned when an unexpected error is encountered.

func (ParserUnexpectedError) Error

func (e ParserUnexpectedError) Error() string

Error returns the string representation of the error.

type ParserUnexpectedInputError

type ParserUnexpectedInputError struct {
	// What was expected.
	Expected []rune
	// Unexpected input.
	Found []rune
	// Position of the input.
	Position int
}

ParserUnexpectedInputError is returned when an unexpected token is found in the parsed input.

func (ParserUnexpectedInputError) Error

Error returns the string representation of the error.

type ParserUnsupportedSubjectFieldError

type ParserUnsupportedSubjectFieldError struct {
	// Consumed unsupported field that did not match.
	Field string
}

ParserUnsupportedSubjectFieldError is an error returned when an unsupported subject field is consumed by the parser.

func (ParserUnsupportedSubjectFieldError) Error

Error returns the string representation of the error.

type ParserValueInsufficientInputError

type ParserValueInsufficientInputError struct {
	// Consumed string at the expected field position.
	ValuePos int
}

ParserValueInsufficientInputError is an error returned when a value list can't be fully parsed because there was no more input.

func (ParserValueInsufficientInputError) Error

Error returns the string representation of the error.

type RegexpKVs

type RegexpKVs map[string][]*regexp.Regexp

RegexpKVs represents compiled regexes for parsed key value client certificate subject when the subject type is a pattern.

type SubjectParser

type SubjectParser interface {
	Parse() (ParsedSubject, error)
}

SubjectParser represents the subject parser.

func NewSubjectParser

func NewSubjectParser(input string) SubjectParser

NewSubjectParser creates a new default subject parser.

Jump to

Keyboard shortcuts

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