forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.go
24 lines (19 loc) · 913 Bytes
/
setup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package providers
import (
"context"
"github.com/rancher/norman/store/subtype"
"github.com/rancher/norman/types"
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, client.ActiveDirectoryConfigType}
func SetupAuthConfig(ctx context.Context, management *config.ScaledContext, schemas *types.Schemas) {
Configure(ctx, management)
authConfigBaseSchema := schemas.Schema(&managementschema.Version, client.AuthConfigType)
for _, authConfigSubtype := range authConfigTypes {
subSchema := schemas.Schema(&managementschema.Version, authConfigSubtype)
GetProviderByType(authConfigSubtype).CustomizeSchema(subSchema)
subSchema.Store = subtype.NewSubTypeStore(authConfigSubtype, authConfigBaseSchema.Store)
}
}