MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / baseTestOptions

Function baseTestOptions

oauthproxy_test.go:2128–2174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2126}
2127
2128func baseTestOptions() *options.Options {
2129 opts := options.NewOptions()
2130 opts.Cookie.Secret = rawCookieSecret
2131 opts.Providers[0].ID = "providerID"
2132 opts.Providers[0].ClientID = clientID
2133 opts.Providers[0].ClientSecret = clientSecret
2134 opts.EmailDomains = []string{"*"}
2135
2136 // Default injected headers for legacy configuration
2137 opts.InjectRequestHeaders = []options.Header{
2138 {
2139 Name: "Authorization",
2140 Values: []options.HeaderValue{
2141 {
2142 ClaimSource: &options.ClaimSource{
2143 Claim: "user",
2144 BasicAuthPassword: &options.SecretSource{
2145 Value: []byte(base64.StdEncoding.EncodeToString([]byte("This is a secure password"))),
2146 },
2147 },
2148 },
2149 },
2150 },
2151 {
2152 Name: "X-Forwarded-User",
2153 Values: []options.HeaderValue{
2154 {
2155 ClaimSource: &options.ClaimSource{
2156 Claim: "user",
2157 },
2158 },
2159 },
2160 },
2161 {
2162 Name: "X-Forwarded-Email",
2163 Values: []options.HeaderValue{
2164 {
2165 ClaimSource: &options.ClaimSource{
2166 Claim: "email",
2167 },
2168 },
2169 },
2170 },
2171 }
2172
2173 return opts
2174}
2175
2176func TestTrustedIPs(t *testing.T) {
2177 tests := []struct {

Calls 1

NewOptionsFunction · 0.92

Tested by

no test coverage detected