| Index: tokenserver/appengine/impl/serviceaccounts/config_validation.go
|
| diff --git a/tokenserver/appengine/impl/serviceaccounts/config_validation.go b/tokenserver/appengine/impl/serviceaccounts/config_validation.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..907e33c085a2b8d79a0fbc7cc60e50446c48d826
|
| --- /dev/null
|
| +++ b/tokenserver/appengine/impl/serviceaccounts/config_validation.go
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2017 The LUCI Authors.
|
| +//
|
| +// Licensed under the Apache License, Version 2.0 (the "License");
|
| +// you may not use this file except in compliance with the License.
|
| +// You may obtain a copy of the License at
|
| +//
|
| +// http://www.apache.org/licenses/LICENSE-2.0
|
| +//
|
| +// Unless required by applicable law or agreed to in writing, software
|
| +// distributed under the License is distributed on an "AS IS" BASIS,
|
| +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| +// See the License for the specific language governing permissions and
|
| +// limitations under the License.
|
| +
|
| +package serviceaccounts
|
| +
|
| +import (
|
| + "github.com/luci/luci-go/common/config/validation"
|
| +
|
| + "github.com/luci/luci-go/tokenserver/api/admin/v1"
|
| + "github.com/luci/luci-go/tokenserver/appengine/impl/utils/policy"
|
| +)
|
| +
|
| +// validateConfigs validates the structure of configs fetched by fetchConfigs.
|
| +func validateConfigs(bundle policy.ConfigBundle, ctx *validation.Context) {
|
| + ctx.SetFile(serviceAccountsCfg)
|
| + cfg, ok := bundle[serviceAccountsCfg].(*admin.ServiceAccountsPermissions)
|
| + if !ok {
|
| + ctx.Error("unexpectedly wrong proto type %T", cfg)
|
| + return
|
| + }
|
| +
|
| + // TODO(vadimsh): Validate cfg.Rules.
|
| +}
|
|
|