@@ -23,12 +23,6 @@ import (
2323 "k8s.io/apiserver/pkg/authorization/authorizer"
2424)
2525
26- // ServeMux contains the methods required to implement a mux that can be wrapped with auth filter
27- type ServeMux interface {
28- Handle (path string , h http.Handler )
29- ServeHTTP (w http.ResponseWriter , r * http.Request )
30- }
31-
3226// ServeMuxWithAuth implements api.ServerMux
3327type ServeMuxWithAuth struct {
3428 auth AuthInterface
@@ -37,25 +31,25 @@ type ServeMuxWithAuth struct {
3731}
3832
3933// NewServeMuxWithAuth initiate an instance for ServeMuxWithAuth
40- func NewServeMuxWithAuth (ctx context.Context , auth AuthInterface ) ServeMux {
34+ func NewServeMuxWithAuth (ctx context.Context , auth AuthInterface ) * ServeMuxWithAuth {
4135 mux := http .NewServeMux ()
42- return ServeMuxWithAuth {
36+ return & ServeMuxWithAuth {
4337 auth : auth ,
4438 ctx : ctx ,
4539 mux : mux ,
4640 }
4741}
4842
4943// Handle enables auth filter for mux Handle
50- func (s ServeMuxWithAuth ) Handle (path string , h http.Handler ) {
44+ func (s * ServeMuxWithAuth ) Handle (path string , h http.Handler ) {
5145 if s .auth == nil {
5246 s .mux .Handle (path , h )
5347 } else {
5448 s .mux .Handle (path , s .authHandler (h ))
5549 }
5650}
5751
58- func (s ServeMuxWithAuth ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
52+ func (s * ServeMuxWithAuth ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
5953 s .mux .ServeHTTP (w , r )
6054}
6155
0 commit comments