@@ -22,6 +22,7 @@ import (
2222 "fmt"
2323 "net"
2424 "os"
25+ "slices"
2526 "time"
2627
2728 "github.com/davecgh/go-spew/spew"
@@ -40,8 +41,7 @@ func New(caBundleFile string, listener net.Listener, addrOverride string) (*Serv
4041 var tlsConfig * tls.Config
4142 s := & Server {}
4243 if caBundleFile != "" {
43- var err error
44- tlsConfig , err = LoadTLSConfig (caBundleFile )
44+ tlsConfig , err := LoadTLSConfig (caBundleFile )
4545 if err != nil {
4646 return nil , fmt .Errorf ("failed to load CA bundle file: %w" , err )
4747 }
@@ -86,7 +86,8 @@ func (s *Server) AddRoutes(mux *mux.Router) {
8686 s .server .AddRoutes (mux )
8787}
8888
89- // URL returns the base URL of the embedded OIDC server.
89+ // Config returns the OIDC configuration for clients to connect to the embedded OIDC server.
90+ // It is partially auto-generated by mockoidc and partially overridden to match kube-bind specific URLs.
9091func (s * Server ) Config (callbackURL , issuerURL string ) (* Config , error ) {
9192 c := & Config {
9293 ClientID : s .server .Config ().ClientID ,
@@ -124,10 +125,8 @@ func ensureOfflineAccessScope() {
124125 offlineAccess := "offline_access"
125126
126127 // Check if offline_access is already in the supported scopes
127- for _ , scope := range mockoidc .ScopesSupported {
128- if scope == offlineAccess {
129- return // Already present
130- }
128+ if slices .Contains (mockoidc .ScopesSupported , offlineAccess ) {
129+ return // Already present
131130 }
132131
133132 // Add offline_access to the supported scopes
0 commit comments