@@ -18,6 +18,7 @@ import (
18
18
kapierrors "k8s.io/kubernetes/pkg/api/errors"
19
19
"k8s.io/kubernetes/pkg/api/unversioned"
20
20
"k8s.io/kubernetes/pkg/apiserver/request"
21
+ "k8s.io/kubernetes/pkg/auth/group"
21
22
"k8s.io/kubernetes/pkg/client/cache"
22
23
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
23
24
"k8s.io/kubernetes/pkg/client/restclient"
@@ -41,7 +42,6 @@ import (
41
42
"github.com/openshift/origin/pkg/auth/authenticator/request/paramtoken"
42
43
"github.com/openshift/origin/pkg/auth/authenticator/request/unionrequest"
43
44
"github.com/openshift/origin/pkg/auth/authenticator/request/x509request"
44
- "github.com/openshift/origin/pkg/auth/group"
45
45
authnregistry "github.com/openshift/origin/pkg/auth/oauth/registry"
46
46
"github.com/openshift/origin/pkg/auth/userregistry/identitymapper"
47
47
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
@@ -665,6 +665,8 @@ func newAuthenticator(config configapi.MasterConfig, restOptionsGetter restoptio
665
665
authenticators = append (authenticators , certauth )
666
666
}
667
667
668
+ resultingAuthenticator := & unionrequest.Authenticator {FailOnError : true , Handlers : authenticators }
669
+
668
670
topLevelAuthenticators := []authenticator.Request {}
669
671
// if we have a front proxy providing authentication configuration, wire it up and it should come first
670
672
if config .AuthConfig .RequestHeader != nil {
@@ -678,15 +680,22 @@ func newAuthenticator(config configapi.MasterConfig, restOptionsGetter restoptio
678
680
if err != nil {
679
681
return nil , fmt .Errorf ("Error building front proxy auth config: %v" , err )
680
682
}
681
- topLevelAuthenticators = append (topLevelAuthenticators , requestHeaderAuthenticator )
683
+ topLevelAuthenticators = append (topLevelAuthenticators , & unionrequest.Authenticator {
684
+ FailOnError : false ,
685
+ Handlers : []authenticator.Request {requestHeaderAuthenticator , resultingAuthenticator },
686
+ })
687
+
688
+ } else {
689
+ topLevelAuthenticators = append (topLevelAuthenticators , resultingAuthenticator )
690
+
682
691
}
683
- topLevelAuthenticators = append ( topLevelAuthenticators , group . NewGroupAdder ( & unionrequest. Authenticator { FailOnError : true , Handlers : authenticators }, [] string { bootstrappolicy . AuthenticatedGroup }))
692
+
684
693
topLevelAuthenticators = append (topLevelAuthenticators , anonymous .NewAuthenticator ())
685
694
686
- return & unionrequest.Authenticator {
695
+ return group . NewAuthenticatedGroupAdder ( & unionrequest.Authenticator {
687
696
FailOnError : true ,
688
697
Handlers : topLevelAuthenticators ,
689
- }, nil
698
+ }) , nil
690
699
}
691
700
692
701
func newProjectAuthorizationCache (authorizer authorizer.Authorizer , kubeClient * kclientset.Clientset , informerFactory shared.InformerFactory ) * projectauth.AuthorizationCache {
0 commit comments