6 "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
9func validateHeaders(headers []options.Header) []string {
12 names := make(map[string]struct{})
14 for _, header := range headers {
15 msgs = append(msgs, validateHeader(header, names)...)
20func validateHeader(header options.Header, names map[string]struct{}) []string {
23 if header.Name == "" {
24 msgs = append(msgs, "header has empty name: names are required for all headers")
27 if _, ok := names[header.Name]; ok {
28 msgs = append(msgs, fmt.Sprintf("multiple headers found with name %q: header names must be unique", header.Name))
30 names[header.Name] = struct{}{}
32 for _, value := range header.Values {
34 prefixValues(fmt.Sprintf("invalid header %q: invalid values: ", header.Name),
35 validateHeaderValue(header.Name, value)...,
42func validateHeaderValue(_ string, value options.HeaderValue) []string {
44 case value.SecretSource != nil && value.ClaimSource == nil:
45 return []string{validateSecretSource(*value.SecretSource)}
46 case value.SecretSource == nil && value.ClaimSource != nil:
47 return validateHeaderValueClaimSource(*value.ClaimSource)
49 return []string{"header value has multiple entries: only one entry per value is allowed"}
53func validateHeaderValueClaimSource(claim options.ClaimSource) []string {
56 if claim.Claim == "" {
57 msgs = append(msgs, "claim should not be empty")
60 if claim.BasicAuthPassword != nil {
61 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