示例#1
0
文件: master.go 项目: Xmagicer/origin
// getAuthenticationResources returns the resources for authentication api
func (m *Master) getAuthenticationResources(c *Config) map[string]rest.Storage {
	// TODO update when we support more than one version of this group
	version := authenticationv1beta1.SchemeGroupVersion

	storage := map[string]rest.Storage{}
	if c.APIResourceConfigSource.ResourceEnabled(version.WithResource("tokenreviews")) {
		tokenReviewStorage := tokenreview.NewREST(c.Authenticator)
		storage["tokenreviews"] = tokenReviewStorage
	}
	return storage
}
func (p AuthenticationRESTStorageProvider) v1beta1Storage(apiResourceConfigSource genericapiserver.APIResourceConfigSource, restOptionsGetter RESTOptionsGetter) map[string]rest.Storage {
	version := authenticationv1beta1.SchemeGroupVersion

	storage := map[string]rest.Storage{}
	if apiResourceConfigSource.AnyResourcesForVersionEnabled(authenticationv1beta1.SchemeGroupVersion) {
		if apiResourceConfigSource.ResourceEnabled(version.WithResource("tokenreviews")) {
			tokenReviewStorage := tokenreview.NewREST(p.Authenticator)
			storage["tokenreviews"] = tokenReviewStorage
		}
	}

	return storage
}