37 Star 403 Fork 75

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
setup.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
Craig Jellick 提交于 2018-02-05 11:27 . Refactor auth code
package providers
import (
"context"
"github.com/rancher/norman/store/subtype"
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/auth/providers/github"
managementschema "github.com/rancher/types/apis/management.cattle.io/v3/schema"
"github.com/rancher/types/client/management/v3"
"github.com/rancher/types/config"
)
var authConfigTypes = []string{client.GithubConfigType, client.LocalConfigType}
func SetupAuthConfig(ctx context.Context, management *config.ManagementContext, schemas *types.Schemas) {
Configure(ctx, management)
schema := schemas.Schema(&managementschema.Version, client.GithubConfigType)
gp, _ := GetProvider("github")
schema.Formatter = github.ConfigFormatter
schema.ActionHandler = gp.ConfigActionHandler
authConfigBaseSchema := schemas.Schema(&managementschema.Version, client.AuthConfigType)
for _, authConfigSubtype := range authConfigTypes {
subSchema := schemas.Schema(&managementschema.Version, authConfigSubtype)
subSchema.Store = subtype.NewSubTypeStore(authConfigSubtype, authConfigBaseSchema.Store)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.0.0-alpha16

搜索帮助