@@ -33,6 +33,7 @@ import (
33
33
"k8s.io/kubernetes/plugin/pkg/admission/namespace/lifecycle"
34
34
saadmit "k8s.io/kubernetes/plugin/pkg/admission/serviceaccount"
35
35
storageclassdefaultadmission "k8s.io/kubernetes/plugin/pkg/admission/storageclass/default"
36
+ "k8s.io/kubernetes/plugin/pkg/auth/authenticator/request/headerrequest"
36
37
37
38
"github.com/openshift/origin/pkg/auth/authenticator"
38
39
"github.com/openshift/origin/pkg/auth/authenticator/anonymous"
@@ -664,16 +665,28 @@ func newAuthenticator(config configapi.MasterConfig, restOptionsGetter restoptio
664
665
authenticators = append (authenticators , certauth )
665
666
}
666
667
667
- ret := & unionrequest.Authenticator {
668
- FailOnError : true ,
669
- Handlers : []authenticator.Request {
670
- // if you change this, have a look at the impersonationFilter where we attach groups to the impersonated user
671
- group .NewGroupAdder (& unionrequest.Authenticator {FailOnError : true , Handlers : authenticators }, []string {bootstrappolicy .AuthenticatedGroup }),
672
- anonymous .NewAuthenticator (),
673
- },
668
+ topLevelAuthenticators := []authenticator.Request {}
669
+ // if we have a front proxy providing authentication configuration, wire it up and it should come first
670
+ if config .AuthConfig .RequestHeader != nil {
671
+ requestHeaderAuthenticator , err := headerrequest .NewSecure (
672
+ config .AuthConfig .RequestHeader .ClientCA ,
673
+ config .AuthConfig .RequestHeader .ClientCommonNames ,
674
+ config .AuthConfig .RequestHeader .UsernameHeaders ,
675
+ config .AuthConfig .RequestHeader .GroupHeaders ,
676
+ config .AuthConfig .RequestHeader .ExtraHeaderPrefixes ,
677
+ )
678
+ if err != nil {
679
+ return nil , err
680
+ }
681
+ topLevelAuthenticators = append (topLevelAuthenticators , requestHeaderAuthenticator )
674
682
}
683
+ topLevelAuthenticators = append (topLevelAuthenticators , group .NewGroupAdder (& unionrequest.Authenticator {FailOnError : true , Handlers : authenticators }, []string {bootstrappolicy .AuthenticatedGroup }))
684
+ topLevelAuthenticators = append (topLevelAuthenticators , anonymous .NewAuthenticator ())
675
685
676
- return ret , nil
686
+ return & unionrequest.Authenticator {
687
+ FailOnError : true ,
688
+ Handlers : topLevelAuthenticators ,
689
+ }, nil
677
690
}
678
691
679
692
func newProjectAuthorizationCache (authorizer authorizer.Authorizer , kubeClient * kclientset.Clientset , informerFactory shared.InformerFactory ) * projectauth.AuthorizationCache {
0 commit comments