代码拉取完成,页面将自动刷新
package publicapi
import (
"context"
"net/http"
"github.com/rancher/norman/store/subtype"
"github.com/rancher/norman/types"
rancherapi "github.com/rancher/rancher/pkg/api"
publicSchema "github.com/rancher/types/apis/management.cattle.io/v3public/schema"
v3public "github.com/rancher/types/client/management/v3public"
"github.com/rancher/types/config"
)
func NewHandler(ctx context.Context, mgmtCtx *config.ScaledContext) (http.Handler, error) {
schemas := types.NewSchemas().AddSchemas(publicSchema.PublicSchemas)
if err := authProviderSchemas(ctx, mgmtCtx, schemas); err != nil {
return nil, err
}
return rancherapi.NewServer(schemas)
}
var authProviderTypes = []string{
v3public.ActiveDirectoryProviderType,
v3public.AzureADProviderType,
v3public.GithubProviderType,
v3public.LocalProviderType,
v3public.OpenLdapProviderType,
v3public.FreeIpaProviderType,
v3public.PingProviderType,
v3public.ADFSProviderType,
v3public.KeyCloakProviderType,
}
func authProviderSchemas(ctx context.Context, management *config.ScaledContext, schemas *types.Schemas) error {
schema := schemas.Schema(&publicSchema.PublicVersion, v3public.AuthProviderType)
setAuthProvidersStore(schema, management)
lh := newLoginHandler(ctx, management)
for _, apSubtype := range authProviderTypes {
subSchema := schemas.Schema(&publicSchema.PublicVersion, apSubtype)
subSchema.Store = subtype.NewSubTypeStore(apSubtype, schema.Store)
subSchema.ActionHandler = lh.login
subSchema.Formatter = loginActionFormatter
}
return nil
}
func loginActionFormatter(apiContext *types.APIContext, resource *types.RawResource) {
resource.AddAction(apiContext, "login")
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。