Skip to content

Commit

Permalink
Merge pull request #13247 from deads2k/auth-03-proxy-groups
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Mar 8, 2017
2 parents 93efd9b + 6e20c55 commit 21527d7
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 53 deletions.
19 changes: 14 additions & 5 deletions pkg/cmd/server/origin/master_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
kapierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apiserver/request"
"k8s.io/kubernetes/pkg/auth/group"
"k8s.io/kubernetes/pkg/client/cache"
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient"
Expand All @@ -41,7 +42,6 @@ import (
"github.com/openshift/origin/pkg/auth/authenticator/request/paramtoken"
"github.com/openshift/origin/pkg/auth/authenticator/request/unionrequest"
"github.com/openshift/origin/pkg/auth/authenticator/request/x509request"
"github.com/openshift/origin/pkg/auth/group"
authnregistry "github.com/openshift/origin/pkg/auth/oauth/registry"
"github.com/openshift/origin/pkg/auth/userregistry/identitymapper"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
Expand Down Expand Up @@ -665,6 +665,8 @@ func newAuthenticator(config configapi.MasterConfig, restOptionsGetter restoptio
authenticators = append(authenticators, certauth)
}

resultingAuthenticator := &unionrequest.Authenticator{FailOnError: true, Handlers: authenticators}

topLevelAuthenticators := []authenticator.Request{}
// if we have a front proxy providing authentication configuration, wire it up and it should come first
if config.AuthConfig.RequestHeader != nil {
Expand All @@ -678,15 +680,22 @@ func newAuthenticator(config configapi.MasterConfig, restOptionsGetter restoptio
if err != nil {
return nil, fmt.Errorf("Error building front proxy auth config: %v", err)
}
topLevelAuthenticators = append(topLevelAuthenticators, requestHeaderAuthenticator)
topLevelAuthenticators = append(topLevelAuthenticators, &unionrequest.Authenticator{
FailOnError: false,
Handlers: []authenticator.Request{requestHeaderAuthenticator, resultingAuthenticator},
})

} else {
topLevelAuthenticators = append(topLevelAuthenticators, resultingAuthenticator)

}
topLevelAuthenticators = append(topLevelAuthenticators, group.NewGroupAdder(&unionrequest.Authenticator{FailOnError: true, Handlers: authenticators}, []string{bootstrappolicy.AuthenticatedGroup}))

topLevelAuthenticators = append(topLevelAuthenticators, anonymous.NewAuthenticator())

return &unionrequest.Authenticator{
return group.NewAuthenticatedGroupAdder(&unionrequest.Authenticator{
FailOnError: true,
Handlers: topLevelAuthenticators,
}, nil
}), nil
}

func newProjectAuthorizationCache(authorizer authorizer.Authorizer, kubeClient *kclientset.Clientset, informerFactory shared.InformerFactory) *projectauth.AuthorizationCache {
Expand Down
64 changes: 30 additions & 34 deletions vendor/k8s.io/kubernetes/pkg/apiserver/authenticator/authn.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions vendor/k8s.io/kubernetes/pkg/auth/group/group_adder_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21527d7

Please sign in to comment.