6 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
9func validateHeaders(headers []options.Header) []string {
11 names := make(map[string]struct{})
13 for _, header := range headers {
14 msgs = append(msgs, validateHeader(header, names)...)
19func validateHeader(header options.Header, names map[string]struct{}) []string {
22 if header.Name == "" {
23 msgs = append(msgs, "header has empty name: names are required for all headers")
26 if _, ok := names[header.Name]; ok {
27 msgs = append(msgs, fmt.Sprintf("multiple headers found with name %q: header names must be unique", header.Name))
29 names[header.Name] = struct{}{}
31 for _, value := range header.Values {
33 prefixValues(fmt.Sprintf("invalid header %q: invalid values: ", header.Name),
34 validateHeaderValue(header.Name, value)...,
41func validateHeaderValue(_ string, value options.HeaderValue) []string {
43 case value.SecretSource != nil && value.ClaimSource == nil:
44 return []string{validateSecretSource(*value.SecretSource)}
45 case value.SecretSource == nil && value.ClaimSource != nil:
46 return validateHeaderValueClaimSource(*value.ClaimSource)
48 return []string{"header value has multiple entries: only one entry per value is allowed"}
52func validateHeaderValueClaimSource(claim options.ClaimSource) []string {
55 if claim.Claim == "" {
56 msgs = append(msgs, "claim should not be empty")
59 if claim.BasicAuthPassword != nil {
60 msgs = append(msgs, prefixValues("invalid basicAuthPassword: ", validateSecretSource(*claim.BasicAuthPassword))...)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list