Skip to content

Commit ec0295f

Browse files
committed
deeper specification of authentication chain in TSB
1 parent c7cf3bf commit ec0295f

File tree

1 file changed

+14
-2
lines changed
  • pkg/openservicebroker/cmd/server

1 file changed

+14
-2
lines changed

pkg/openservicebroker/cmd/server/start.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import (
77

88
"github.com/spf13/cobra"
99

10+
"k8s.io/apiserver/pkg/authentication/authenticatorfactory"
1011
genericapiserver "k8s.io/apiserver/pkg/server"
1112
genericoptions "k8s.io/apiserver/pkg/server/options"
13+
authenticationclient "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
14+
"k8s.io/client-go/rest"
1215

1316
"github.com/openshift/origin/pkg/openservicebroker/server"
1417
)
@@ -99,11 +102,20 @@ func (o TemplateServiceBrokerServerOptions) Config() (*server.TemplateServiceBro
99102
//}
100103
// the TSB server *can* limp along without terminating client certs or front proxy authn. Do that for now
101104
// this wiring is a bit tricky.
102-
cfg, err := o.Authentication.ToAuthenticationConfig()
105+
clientConfig, err := rest.InClusterConfig()
103106
if err != nil {
104107
return nil, err
105108
}
106-
authenticator, _, err := cfg.New()
109+
client, err := authenticationclient.NewForConfig(clientConfig)
110+
if err != nil {
111+
return nil, err
112+
}
113+
authenticationConfig := authenticatorfactory.DelegatingAuthenticatorConfig{
114+
Anonymous: true,
115+
TokenAccessReviewClient: client.TokenReviews(),
116+
CacheTTL: o.Authentication.CacheTTL,
117+
}
118+
authenticator, _, err := authenticationConfig.New()
107119
if err != nil {
108120
return nil, err
109121
}

0 commit comments

Comments
 (0)