make well-known users and groups into constants

This commit is contained in:
deads2k
2016-09-29 16:27:14 -04:00
parent 4c8959df59
commit 57039cfdfa
11 changed files with 47 additions and 32 deletions

View File

@@ -165,15 +165,15 @@ func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Se
if masterConfig.GenericConfig.Authenticator != nil {
tokens := make(map[string]*user.DefaultInfo)
tokens[privilegedLoopbackToken] = &user.DefaultInfo{
Name: "system:apiserver",
Name: user.APIServerUser,
UID: uuid.NewRandom().String(),
Groups: []string{"system:masters"},
Groups: []string{user.SystemPrivilegedGroup},
}
tokenAuthenticator := authenticator.NewAuthenticatorFromTokens(tokens)
masterConfig.GenericConfig.Authenticator = authenticatorunion.New(tokenAuthenticator, masterConfig.GenericConfig.Authenticator)
tokenAuthorizer := authorizer.NewPrivilegedGroups("system:masters")
tokenAuthorizer := authorizer.NewPrivilegedGroups(user.SystemPrivilegedGroup)
masterConfig.GenericConfig.Authorizer = authorizerunion.New(tokenAuthorizer, masterConfig.GenericConfig.Authorizer)
masterConfig.GenericConfig.LoopbackClientConfig.BearerToken = privilegedLoopbackToken