forked from theopenlane/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder.go
More file actions
96 lines (94 loc) · 3.77 KB
/
Copy pathbuilder.go
File metadata and controls
96 lines (94 loc) · 3.77 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package keycloak
import (
"github.com/theopenlane/core/internal/ent/integrationgenerated"
"github.com/theopenlane/core/internal/integrations/registry"
"github.com/theopenlane/core/internal/integrations/types"
"github.com/theopenlane/core/pkg/jsonx"
)
// Builder returns the Keycloak definition builder
func Builder() registry.Builder {
return registry.Builder(func() (types.Definition, error) {
return types.Definition{
DefinitionSpec: types.DefinitionSpec{
ID: definitionID.ID(),
Family: "Keycloak",
DisplayName: "Keycloak",
Description: "Collect Keycloak realm users, groups, and memberships for identity posture and access governance.",
Category: "identity",
DocsURL: "https://docs.theopenlane.io/docs/platform/integrations/keycloak/overview",
Tags: []string{"directory"},
Active: false,
Visible: true,
},
UserInput: &types.UserInputRegistration{
Schema: jsonx.SchemaFrom[UserInput](),
},
CredentialRegistrations: []types.CredentialRegistration{
{
Ref: keycloakCredential.ID(),
Name: "Keycloak Credential",
Description: "Client credentials used to access Keycloak realm data.",
Schema: keycloakCredentialSchema,
},
},
Connections: []types.ConnectionRegistration{
{
CredentialRef: keycloakCredential.ID(),
Name: "Keycloak Client Credentials",
Description: "Configure Keycloak access using client credentials from your realm.",
CredentialRefs: []types.CredentialSlotID{keycloakCredential.ID()},
ClientRefs: []types.ClientID{keycloakClient.ID()},
ValidationOperation: healthCheckOperation.Name(),
Integration: integration.Registration(),
Disconnect: &types.DisconnectRegistration{
CredentialRef: keycloakCredential.ID(),
Description: "Removes the stored client credentials from Openlane. If the client is no longer needed, disable or delete it in your Keycloak admin console under Clients.",
},
},
},
Clients: []types.ClientRegistration{
{
Ref: keycloakClient.ID(),
CredentialRefs: []types.CredentialSlotID{keycloakCredential.ID()},
Description: "Keycloak API client",
Build: Client{}.Build,
},
},
Operations: []types.OperationRegistration{
{
Name: healthCheckOperation.Name(),
Description: "Call Keycloak realm API to verify client credentials and realm connectivity",
Topic: definitionID.OperationTopic(healthCheckOperation.Name()),
ClientRef: keycloakClient.ID(),
Policy: types.ExecutionPolicy{Inline: true},
ConfigSchema: healthCheckSchema,
Handle: HealthCheck{}.Handle(),
RequiredPermissions: []string{"view-realm"},
},
{
Name: directorySyncOperation.Name(),
Description: "Collect Keycloak realm users, groups, and memberships as directory accounts",
Topic: definitionID.OperationTopic(directorySyncOperation.Name()),
ClientRef: keycloakClient.ID(),
ConfigSchema: directorySyncSchema,
Policy: types.ExecutionPolicy{Reconcile: true},
SkipDefaultLookback: true,
RequiredPermissions: []string{"view-users", "query-groups", "view-events"},
Ingest: []types.IngestContract{
{
Schema: integrationgenerated.IntegrationMappingSchemaDirectoryAccount,
},
{
Schema: integrationgenerated.IntegrationMappingSchemaDirectoryGroup,
},
{
Schema: integrationgenerated.IntegrationMappingSchemaDirectoryMembership,
},
},
IngestHandle: DirectorySync{}.IngestHandle(),
},
},
Mappings: keycloakMappings(),
}, nil
})
}