1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-05-21 22:33:38 +02:00

46 lines
1.8 KiB
Go
Raw Normal View History

2020-07-23 10:05:59 +01:00
package options
// Header represents an individual header that will be added to a request or
// response header.
type Header struct {
// Name is the header name to be used for this set of values.
// Names should be unique within a list of Headers.
Name string `json:"name,omitempty"`
2020-07-23 10:05:59 +01:00
// PreserveRequestValue determines whether any values for this header
// should be preserved for the request to the upstream server.
// This option only applies to injected request headers.
2020-07-23 10:05:59 +01:00
// Defaults to false (headers that match this header will be stripped).
PreserveRequestValue bool `json:"preserveRequestValue,omitempty"`
2020-07-23 10:05:59 +01:00
// Values contains the desired values for this header
Values []HeaderValue `json:"values,omitempty"`
2020-07-23 10:05:59 +01:00
}
// HeaderValue represents a single header value and the sources that can
// make up the header value
type HeaderValue struct {
// Allow users to load the value from a secret source
*SecretSource `json:",omitempty"`
2020-07-23 10:05:59 +01:00
// Allow users to load the value from a session claim
*ClaimSource `json:",omitempty"`
2020-07-23 10:05:59 +01:00
}
// ClaimSource allows loading a header value from a claim within the session
type ClaimSource struct {
// Claim is the name of the claim in the session that the value should be
// loaded from. Available claims: `access_token` `id_token` `created_at`
// `expires_on` `refresh_token` `email` `user` `groups` `preferred_username`.
2020-07-23 10:05:59 +01:00
Claim string `json:"claim,omitempty"`
// Prefix is an optional prefix that will be prepended to the value of the
// claim if it is non-empty.
Prefix string `json:"prefix,omitempty"`
// BasicAuthPassword converts this claim into a basic auth header.
// Note the value of claim will become the basic auth username and the
// basicAuthPassword will be used as the password value.
BasicAuthPassword *SecretSource `json:"basicAuthPassword,omitempty"`
2020-07-23 10:05:59 +01:00
}