You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-21 00:29:44 +02:00
Fixup main
This commit is contained in:
5
main.go
5
main.go
@ -41,7 +41,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *convertConfig && *alphaConfig != "" {
|
if *convertConfig && *alphaConfig != "" {
|
||||||
logger.Fatal("cannot use alpha-config and conver-config-to-alpha together")
|
klog.Fatal("cannot use alpha-config and conver-config-to-alpha together")
|
||||||
}
|
}
|
||||||
|
|
||||||
opts, err := loadConfiguration(*config, *alphaConfig, configFlagSet, os.Args[1:])
|
opts, err := loadConfiguration(*config, *alphaConfig, configFlagSet, os.Args[1:])
|
||||||
@ -189,6 +189,9 @@ func configureKlog(logLevel int) {
|
|||||||
if err := klogFlags.Lookup("skip_headers").Value.Set("true"); err != nil {
|
if err := klogFlags.Lookup("skip_headers").Value.Set("true"); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
if err := klogFlags.Lookup("stderrthreshold").Value.Set("4"); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
// If this fails, it's a user input error
|
// If this fails, it's a user input error
|
||||||
if err := klogFlags.Lookup("v").Value.Set(fmt.Sprintf("%d", logLevel)); err != nil {
|
if err := klogFlags.Lookup("v").Value.Set(fmt.Sprintf("%d", logLevel)); err != nil {
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
|
|
||||||
"github.com/coreos/go-oidc/v3/oidc"
|
"github.com/coreos/go-oidc/v3/oidc"
|
||||||
"github.com/mbland/hmacauth"
|
"github.com/mbland/hmacauth"
|
||||||
|
middlewareapi "github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/middleware"
|
||||||
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
|
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
|
||||||
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
|
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/sessions"
|
||||||
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/cookies"
|
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/cookies"
|
||||||
@ -35,6 +36,7 @@ const (
|
|||||||
base64CookieSecret = "c2VjcmV0dGhpcnR5dHdvYnl0ZXMrYWJjZGVmZ2hpams"
|
base64CookieSecret = "c2VjcmV0dGhpcnR5dHdvYnl0ZXMrYWJjZGVmZ2hpams"
|
||||||
clientID = "3984n253984d7348dm8234yf982t"
|
clientID = "3984n253984d7348dm8234yf982t"
|
||||||
clientSecret = "gv3498mfc9t23y23974dm2394dm9"
|
clientSecret = "gv3498mfc9t23y23974dm2394dm9"
|
||||||
|
testRequestID = "11111111-2222-4333-8444-555555555555"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -2371,6 +2373,9 @@ func TestAllowedRequest(t *testing.T) {
|
|||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
req, err := http.NewRequest(tc.method, tc.url, nil)
|
req, err := http.NewRequest(tc.method, tc.url, nil)
|
||||||
|
req = middlewareapi.AddRequestScope(req, &middlewareapi.RequestScope{
|
||||||
|
RequestID: testRequestID,
|
||||||
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, tc.allowed, proxy.isAllowedRoute(req))
|
assert.Equal(t, tc.allowed, proxy.isAllowedRoute(req))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user