forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.go
39 lines (34 loc) · 1.32 KB
/
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package providers
import (
"context"
"github.com/rancher/norman/store/subtype"
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/api/store/auth"
"github.com/rancher/rancher/pkg/namespace"
managementschema "github.com/rancher/types/apis/management.cattle.io/v3/schema"
client "github.com/rancher/types/client/management/v3"
"github.com/rancher/types/config"
)
var authConfigTypes = []string{
client.GithubConfigType,
client.LocalConfigType,
client.ActiveDirectoryConfigType,
client.AzureADConfigType,
client.OpenLdapConfigType,
client.FreeIpaConfigType,
client.PingConfigType,
client.ADFSConfigType,
client.KeyCloakConfigType,
client.OKTAConfigType,
client.GoogleOauthConfigType,
}
func SetupAuthConfig(ctx context.Context, management *config.ScaledContext, schemas *types.Schemas) {
Configure(ctx, management)
authConfigBaseSchema := schemas.Schema(&managementschema.Version, client.AuthConfigType)
authConfigBaseSchema.Store = auth.Wrap(authConfigBaseSchema.Store, management.Core.Secrets(namespace.GlobalNamespace))
for _, authConfigSubtype := range authConfigTypes {
subSchema := schemas.Schema(&managementschema.Version, authConfigSubtype)
GetProviderByType(authConfigSubtype).CustomizeSchema(subSchema)
subSchema.Store = subtype.NewSubTypeStore(authConfigSubtype, authConfigBaseSchema.Store)
}
}