Skip to content

Commit

Permalink
feat: make path for /auth/ and apikey password unprotected in gateway (
Browse files Browse the repository at this point in the history
  • Loading branch information
yadzhang committed Mar 27, 2020
1 parent 06df0a7 commit dbefdde
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/auth/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ import (
"tkestack.io/tke/pkg/util/log"
)

const (
OIDCPath = "/oidc/"
AuthPath = "/auth/"
APIKeyPasswordPath = "/apis/auth.tkestack.io/v1/apikeys/default/password"
)

func IgnoreAuthPathPrefixes() []string {
return []string{
"/oidc/",
"/auth/",
"/apis/auth.tkestack.io/v1/apikeys/default/password",
OIDCPath,
AuthPath,
APIKeyPasswordPath,
}
}

Expand Down
10 changes: 10 additions & 0 deletions pkg/gateway/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package proxy

import (
"fmt"

"k8s.io/apiserver/pkg/server/mux"
"tkestack.io/tke/api/auth"
"tkestack.io/tke/api/business"
Expand All @@ -31,6 +32,7 @@ import (
"tkestack.io/tke/pkg/gateway/proxy/handler/frontproxy"
"tkestack.io/tke/pkg/gateway/proxy/handler/passthrough"
platformapiserver "tkestack.io/tke/pkg/platform/apiserver"
authapiserver "tkestack.io/tke/pkg/auth/apiserver"
"tkestack.io/tke/pkg/registry/chartmuseum"
"tkestack.io/tke/pkg/registry/distribution"
"tkestack.io/tke/pkg/util/log"
Expand Down Expand Up @@ -78,6 +80,14 @@ func componentPrefix() map[moduleName][]modulePath {
prefix: fmt.Sprintf("%s/%s/", apiPrefix, auth.GroupName),
protected: true,
},
modulePath{
prefix: authapiserver.AuthPath,
protected: false,
},
modulePath{
prefix: fmt.Sprintf("%s/", authapiserver.APIKeyPasswordPath),
protected: false,
},
},
moduleNameMonitor: {
modulePath{
Expand Down

0 comments on commit dbefdde

Please sign in to comment.