cartography 0.111.0rc1__py3-none-any.whl → 0.113.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cartography might be problematic. Click here for more details.
- cartography/_version.py +2 -2
- cartography/cli.py +57 -0
- cartography/config.py +24 -0
- cartography/data/indexes.cypher +0 -6
- cartography/data/jobs/analysis/keycloak_inheritance.json +30 -0
- cartography/intel/aws/apigateway.py +128 -17
- cartography/intel/aws/apigatewayv2.py +116 -0
- cartography/intel/aws/ec2/instances.py +3 -1
- cartography/intel/aws/ec2/network_interfaces.py +1 -1
- cartography/intel/aws/ec2/vpc_peerings.py +262 -125
- cartography/intel/aws/resources.py +2 -0
- cartography/intel/azure/__init__.py +35 -32
- cartography/intel/azure/subscription.py +2 -2
- cartography/intel/azure/tenant.py +39 -30
- cartography/intel/azure/util/credentials.py +49 -174
- cartography/intel/entra/__init__.py +47 -1
- cartography/intel/entra/applications.py +220 -170
- cartography/intel/entra/groups.py +41 -22
- cartography/intel/entra/ou.py +28 -20
- cartography/intel/entra/users.py +24 -18
- cartography/intel/gcp/__init__.py +32 -11
- cartography/intel/gcp/compute.py +47 -12
- cartography/intel/gcp/dns.py +82 -169
- cartography/intel/gcp/iam.py +66 -54
- cartography/intel/gcp/storage.py +75 -159
- cartography/intel/github/repos.py +19 -10
- cartography/intel/github/util.py +12 -0
- cartography/intel/keycloak/__init__.py +153 -0
- cartography/intel/keycloak/authenticationexecutions.py +322 -0
- cartography/intel/keycloak/authenticationflows.py +77 -0
- cartography/intel/keycloak/clients.py +187 -0
- cartography/intel/keycloak/groups.py +126 -0
- cartography/intel/keycloak/identityproviders.py +94 -0
- cartography/intel/keycloak/organizations.py +163 -0
- cartography/intel/keycloak/realms.py +61 -0
- cartography/intel/keycloak/roles.py +202 -0
- cartography/intel/keycloak/scopes.py +73 -0
- cartography/intel/keycloak/users.py +70 -0
- cartography/intel/keycloak/util.py +47 -0
- cartography/intel/kubernetes/__init__.py +26 -0
- cartography/intel/kubernetes/eks.py +402 -0
- cartography/intel/kubernetes/rbac.py +133 -0
- cartography/models/aws/apigateway/apigatewayintegration.py +79 -0
- cartography/models/aws/apigateway/apigatewaymethod.py +74 -0
- cartography/models/aws/apigatewayv2/__init__.py +0 -0
- cartography/models/aws/apigatewayv2/apigatewayv2.py +53 -0
- cartography/models/aws/ec2/vpc_peering.py +157 -0
- cartography/models/azure/principal.py +44 -0
- cartography/models/azure/tenant.py +20 -0
- cartography/models/gcp/dns.py +109 -0
- cartography/models/gcp/iam.py +3 -0
- cartography/models/gcp/storage/__init__.py +0 -0
- cartography/models/gcp/storage/bucket.py +119 -0
- cartography/models/keycloak/__init__.py +0 -0
- cartography/models/keycloak/authenticationexecution.py +160 -0
- cartography/models/keycloak/authenticationflow.py +54 -0
- cartography/models/keycloak/client.py +177 -0
- cartography/models/keycloak/group.py +101 -0
- cartography/models/keycloak/identityprovider.py +89 -0
- cartography/models/keycloak/organization.py +116 -0
- cartography/models/keycloak/organizationdomain.py +73 -0
- cartography/models/keycloak/realm.py +173 -0
- cartography/models/keycloak/role.py +126 -0
- cartography/models/keycloak/scope.py +73 -0
- cartography/models/keycloak/user.py +51 -0
- cartography/models/kubernetes/clusterrolebindings.py +40 -0
- cartography/models/kubernetes/groups.py +107 -0
- cartography/models/kubernetes/oidc.py +51 -0
- cartography/models/kubernetes/rolebindings.py +40 -0
- cartography/models/kubernetes/users.py +105 -0
- cartography/sync.py +2 -0
- cartography/util.py +10 -0
- {cartography-0.111.0rc1.dist-info → cartography-0.113.0.dist-info}/METADATA +9 -5
- {cartography-0.111.0rc1.dist-info → cartography-0.113.0.dist-info}/RECORD +78 -41
- cartography/data/jobs/cleanup/aws_import_vpc_peering_cleanup.json +0 -45
- cartography/data/jobs/cleanup/gcp_dns_cleanup.json +0 -29
- cartography/data/jobs/cleanup/gcp_storage_bucket_cleanup.json +0 -29
- {cartography-0.111.0rc1.dist-info → cartography-0.113.0.dist-info}/WHEEL +0 -0
- {cartography-0.111.0rc1.dist-info → cartography-0.113.0.dist-info}/entry_points.txt +0 -0
- {cartography-0.111.0rc1.dist-info → cartography-0.113.0.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.111.0rc1.dist-info → cartography-0.113.0.dist-info}/top_level.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_source_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
11
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
12
|
+
from cartography.models.core.relationships import SourceNodeMatcher
|
|
13
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True)
|
|
17
|
+
class KeycloakAuthenticationExecutionNodeProperties(CartographyNodeProperties):
|
|
18
|
+
id: PropertyRef = PropertyRef("id")
|
|
19
|
+
display_name: PropertyRef = PropertyRef("displayName")
|
|
20
|
+
requirement: PropertyRef = PropertyRef("requirement")
|
|
21
|
+
description: PropertyRef = PropertyRef("description")
|
|
22
|
+
configurable: PropertyRef = PropertyRef("configurable")
|
|
23
|
+
authentication_flow: PropertyRef = PropertyRef("authenticationFlow")
|
|
24
|
+
provider_id: PropertyRef = PropertyRef("providerId")
|
|
25
|
+
flow_id: PropertyRef = PropertyRef("flowId")
|
|
26
|
+
level: PropertyRef = PropertyRef("level")
|
|
27
|
+
index: PropertyRef = PropertyRef("index")
|
|
28
|
+
priority: PropertyRef = PropertyRef("priority")
|
|
29
|
+
is_terminal_step: PropertyRef = PropertyRef("is_terminal_step")
|
|
30
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class KeycloakAuthenticationExecutionToRealmRelProperties(CartographyRelProperties):
|
|
35
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True)
|
|
39
|
+
# (:KeycloakAuthenticationExecution)<-[:RESOURCE]-(:KeycloakRealm)
|
|
40
|
+
class KeycloakAuthenticationExecutionToRealmRel(CartographyRelSchema):
|
|
41
|
+
target_node_label: str = "KeycloakRealm"
|
|
42
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
43
|
+
{"name": PropertyRef("REALM", set_in_kwargs=True)},
|
|
44
|
+
)
|
|
45
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
46
|
+
rel_label: str = "RESOURCE"
|
|
47
|
+
properties: KeycloakAuthenticationExecutionToRealmRelProperties = (
|
|
48
|
+
KeycloakAuthenticationExecutionToRealmRelProperties()
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass(frozen=True)
|
|
53
|
+
class ExecutionToFlowRelProperties(CartographyRelProperties):
|
|
54
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
# (:KeycloakAuthenticationExecution)<-[:HAS_STEP]-(:KeycloakAuthenticationFlow)
|
|
59
|
+
class ExecutionToFlowRel(CartographyRelSchema):
|
|
60
|
+
target_node_label: str = "KeycloakAuthenticationFlow"
|
|
61
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
62
|
+
{
|
|
63
|
+
"alias": PropertyRef("_parent_flow"),
|
|
64
|
+
"realm": PropertyRef("REALM", set_in_kwargs=True),
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
68
|
+
rel_label: str = "HAS_STEP"
|
|
69
|
+
properties: ExecutionToFlowRelProperties = ExecutionToFlowRelProperties()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass(frozen=True)
|
|
73
|
+
class ExecutionToExecutionRelProperties(CartographyRelProperties):
|
|
74
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass(frozen=True)
|
|
78
|
+
# (:KeycloakAuthenticationExecution)<-[:HAS_STEP]-(:KeycloakAuthenticationExecution)
|
|
79
|
+
class ExecutionToExecutionRel(CartographyRelSchema):
|
|
80
|
+
target_node_label: str = "KeycloakAuthenticationExecution"
|
|
81
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
82
|
+
{"id": PropertyRef("_parent_subflow")},
|
|
83
|
+
)
|
|
84
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
85
|
+
rel_label: str = "HAS_STEP"
|
|
86
|
+
properties: ExecutionToExecutionRelProperties = ExecutionToExecutionRelProperties()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclass(frozen=True)
|
|
90
|
+
class KeycloakAuthenticationExecutionSchema(CartographyNodeSchema):
|
|
91
|
+
label: str = "KeycloakAuthenticationExecution"
|
|
92
|
+
properties: KeycloakAuthenticationExecutionNodeProperties = (
|
|
93
|
+
KeycloakAuthenticationExecutionNodeProperties()
|
|
94
|
+
)
|
|
95
|
+
sub_resource_relationship: KeycloakAuthenticationExecutionToRealmRel = (
|
|
96
|
+
KeycloakAuthenticationExecutionToRealmRel()
|
|
97
|
+
)
|
|
98
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
99
|
+
[ExecutionToFlowRel(), ExecutionToExecutionRel()]
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# The following relationships are MatchLinks, they are used to modelize all the possible flows
|
|
104
|
+
@dataclass(frozen=True)
|
|
105
|
+
class ExecutionToExecutionStepRelProperties(CartographyRelProperties):
|
|
106
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
107
|
+
# Mandatory fields for MatchLinks
|
|
108
|
+
_sub_resource_label: PropertyRef = PropertyRef(
|
|
109
|
+
"_sub_resource_label", set_in_kwargs=True
|
|
110
|
+
)
|
|
111
|
+
_sub_resource_id: PropertyRef = PropertyRef("_sub_resource_id", set_in_kwargs=True)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@dataclass(frozen=True)
|
|
115
|
+
# (:KeycloakAuthenticationExecution)-[:NEXT_STEP]->(:KeycloakAuthenticationExecution)
|
|
116
|
+
class ExecutionToExecutionMatchLink(CartographyRelSchema):
|
|
117
|
+
source_node_label: str = "KeycloakAuthenticationExecution"
|
|
118
|
+
source_node_matcher: SourceNodeMatcher = make_source_node_matcher(
|
|
119
|
+
{"id": PropertyRef("source")},
|
|
120
|
+
)
|
|
121
|
+
target_node_label: str = "KeycloakAuthenticationExecution"
|
|
122
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
123
|
+
{"id": PropertyRef("target")},
|
|
124
|
+
)
|
|
125
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
126
|
+
rel_label: str = "NEXT_STEP"
|
|
127
|
+
properties: ExecutionToExecutionStepRelProperties = (
|
|
128
|
+
ExecutionToExecutionStepRelProperties()
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@dataclass(frozen=True)
|
|
133
|
+
class ExecutionToFlowStepRelProperties(CartographyRelProperties):
|
|
134
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
135
|
+
# Mandatory fields for MatchLinks
|
|
136
|
+
_sub_resource_label: PropertyRef = PropertyRef(
|
|
137
|
+
"_sub_resource_label", set_in_kwargs=True
|
|
138
|
+
)
|
|
139
|
+
_sub_resource_id: PropertyRef = PropertyRef("_sub_resource_id", set_in_kwargs=True)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@dataclass(frozen=True)
|
|
143
|
+
# (:KeycloakAuthenticationFlow)-[:NEXT_STEP]->(:KeycloakAuthenticationExecution)
|
|
144
|
+
class ExecutionToFlowMatchLink(CartographyRelSchema):
|
|
145
|
+
source_node_label: str = "KeycloakAuthenticationExecution"
|
|
146
|
+
source_node_matcher: SourceNodeMatcher = make_source_node_matcher(
|
|
147
|
+
{"id": PropertyRef("execution_id")},
|
|
148
|
+
)
|
|
149
|
+
target_node_label: str = "KeycloakAuthenticationFlow"
|
|
150
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
151
|
+
{
|
|
152
|
+
"alias": PropertyRef("flow_name"),
|
|
153
|
+
"realm": PropertyRef(
|
|
154
|
+
"realm"
|
|
155
|
+
), # We need to pass the realm to match the flow correctly as aliases can be shared across realms
|
|
156
|
+
},
|
|
157
|
+
)
|
|
158
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
159
|
+
rel_label: str = "NEXT_STEP"
|
|
160
|
+
properties: ExecutionToFlowStepRelProperties = ExecutionToFlowStepRelProperties()
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class KeycloakAuthenticationFlowNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
alias: PropertyRef = PropertyRef("alias", extra_index=True)
|
|
17
|
+
description: PropertyRef = PropertyRef("description")
|
|
18
|
+
provider_id: PropertyRef = PropertyRef("providerId")
|
|
19
|
+
top_level: PropertyRef = PropertyRef("topLevel")
|
|
20
|
+
built_in: PropertyRef = PropertyRef("builtIn")
|
|
21
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
22
|
+
# We need to store the realm name because authentication flows are often referenced by name
|
|
23
|
+
# and not by id, so we need to be able to find the authentication flows by name (that is not unique across realms)
|
|
24
|
+
realm: PropertyRef = PropertyRef("REALM", set_in_kwargs=True, extra_index=True)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
class KeycloakAuthenticationFlowToRealmRelProperties(CartographyRelProperties):
|
|
29
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
# (:KeycloakAuthenticationFlow)<-[:RESOURCE]-(:KeycloakRealm)
|
|
34
|
+
class KeycloakAuthenticationFlowToRealmRel(CartographyRelSchema):
|
|
35
|
+
target_node_label: str = "KeycloakRealm"
|
|
36
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
37
|
+
{"name": PropertyRef("REALM", set_in_kwargs=True)},
|
|
38
|
+
)
|
|
39
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
40
|
+
rel_label: str = "RESOURCE"
|
|
41
|
+
properties: KeycloakAuthenticationFlowToRealmRelProperties = (
|
|
42
|
+
KeycloakAuthenticationFlowToRealmRelProperties()
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class KeycloakAuthenticationFlowSchema(CartographyNodeSchema):
|
|
48
|
+
label: str = "KeycloakAuthenticationFlow"
|
|
49
|
+
properties: KeycloakAuthenticationFlowNodeProperties = (
|
|
50
|
+
KeycloakAuthenticationFlowNodeProperties()
|
|
51
|
+
)
|
|
52
|
+
sub_resource_relationship: KeycloakAuthenticationFlowToRealmRel = (
|
|
53
|
+
KeycloakAuthenticationFlowToRealmRel()
|
|
54
|
+
)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_source_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
11
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
12
|
+
from cartography.models.core.relationships import SourceNodeMatcher
|
|
13
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True)
|
|
17
|
+
class KeycloakClientNodeProperties(CartographyNodeProperties):
|
|
18
|
+
id: PropertyRef = PropertyRef("id")
|
|
19
|
+
client_id: PropertyRef = PropertyRef("clientId")
|
|
20
|
+
name: PropertyRef = PropertyRef("name")
|
|
21
|
+
description: PropertyRef = PropertyRef("description")
|
|
22
|
+
type: PropertyRef = PropertyRef("type")
|
|
23
|
+
root_url: PropertyRef = PropertyRef("rootUrl")
|
|
24
|
+
admin_url: PropertyRef = PropertyRef("adminUrl")
|
|
25
|
+
base_url: PropertyRef = PropertyRef("baseUrl")
|
|
26
|
+
surrogate_auth_required: PropertyRef = PropertyRef("surrogateAuthRequired")
|
|
27
|
+
enabled: PropertyRef = PropertyRef("enabled")
|
|
28
|
+
always_display_in_console: PropertyRef = PropertyRef("alwaysDisplayInConsole")
|
|
29
|
+
client_authenticator_type: PropertyRef = PropertyRef("clientAuthenticatorType")
|
|
30
|
+
registration_access_token: PropertyRef = PropertyRef("registrationAccessToken")
|
|
31
|
+
not_before: PropertyRef = PropertyRef("notBefore")
|
|
32
|
+
bearer_only: PropertyRef = PropertyRef("bearerOnly")
|
|
33
|
+
consent_required: PropertyRef = PropertyRef("consentRequired")
|
|
34
|
+
standard_flow_enabled: PropertyRef = PropertyRef("standardFlowEnabled")
|
|
35
|
+
implicit_flow_enabled: PropertyRef = PropertyRef("implicitFlowEnabled")
|
|
36
|
+
direct_access_grants_enabled: PropertyRef = PropertyRef("directAccessGrantsEnabled")
|
|
37
|
+
service_accounts_enabled: PropertyRef = PropertyRef("serviceAccountsEnabled")
|
|
38
|
+
authorization_services_enabled: PropertyRef = PropertyRef(
|
|
39
|
+
"authorizationServicesEnabled"
|
|
40
|
+
)
|
|
41
|
+
direct_grants_only: PropertyRef = PropertyRef("directGrantsOnly")
|
|
42
|
+
public_client: PropertyRef = PropertyRef("publicClient")
|
|
43
|
+
frontchannel_logout: PropertyRef = PropertyRef("frontchannelLogout")
|
|
44
|
+
protocol: PropertyRef = PropertyRef("protocol")
|
|
45
|
+
full_scope_allowed: PropertyRef = PropertyRef("fullScopeAllowed")
|
|
46
|
+
node_re_registration_timeout: PropertyRef = PropertyRef("nodeReRegistrationTimeout")
|
|
47
|
+
client_template: PropertyRef = PropertyRef("clientTemplate")
|
|
48
|
+
use_template_config: PropertyRef = PropertyRef("useTemplateConfig")
|
|
49
|
+
use_template_scope: PropertyRef = PropertyRef("useTemplateScope")
|
|
50
|
+
use_template_mappers: PropertyRef = PropertyRef("useTemplateMappers")
|
|
51
|
+
origin: PropertyRef = PropertyRef("origin")
|
|
52
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class KeycloakClientToRealmRelProperties(CartographyRelProperties):
|
|
57
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
# (:KeycloakClient)<-[:RESOURCE]-(:KeycloakRealm)
|
|
62
|
+
class KeycloakClientToRealmRel(CartographyRelSchema):
|
|
63
|
+
target_node_label: str = "KeycloakRealm"
|
|
64
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
65
|
+
{"name": PropertyRef("REALM", set_in_kwargs=True)},
|
|
66
|
+
)
|
|
67
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
68
|
+
rel_label: str = "RESOURCE"
|
|
69
|
+
properties: KeycloakClientToRealmRelProperties = (
|
|
70
|
+
KeycloakClientToRealmRelProperties()
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class KeycloakClientToDefaultScopeRelProperties(CartographyRelProperties):
|
|
76
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
# (:KeycloakClient)-[:HAS_DEFAULT_SCOPE]->(:KeycloakScope)
|
|
81
|
+
class KeycloakClientToDefaultScopeRel(CartographyRelSchema):
|
|
82
|
+
target_node_label: str = "KeycloakScope"
|
|
83
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
84
|
+
{
|
|
85
|
+
"name": PropertyRef("defaultClientScopes", one_to_many=True),
|
|
86
|
+
"realm": PropertyRef("REALM", set_in_kwargs=True),
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
90
|
+
rel_label: str = "HAS_DEFAULT_SCOPE"
|
|
91
|
+
properties: KeycloakClientToDefaultScopeRelProperties = (
|
|
92
|
+
KeycloakClientToDefaultScopeRelProperties()
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@dataclass(frozen=True)
|
|
97
|
+
class KeycloakClientToOptionalScopeRelProperties(CartographyRelProperties):
|
|
98
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@dataclass(frozen=True)
|
|
102
|
+
# (:KeycloakClient)-[:HAS_OPTIONAL_SCOPE]->(:KeycloakScope)
|
|
103
|
+
class KeycloakClientToOptionalScopeRel(CartographyRelSchema):
|
|
104
|
+
target_node_label: str = "KeycloakScope"
|
|
105
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
106
|
+
{
|
|
107
|
+
"name": PropertyRef("optionalClientScopes", one_to_many=True),
|
|
108
|
+
"realm": PropertyRef("REALM", set_in_kwargs=True),
|
|
109
|
+
},
|
|
110
|
+
)
|
|
111
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
112
|
+
rel_label: str = "HAS_OPTIONAL_SCOPE"
|
|
113
|
+
properties: KeycloakClientToOptionalScopeRelProperties = (
|
|
114
|
+
KeycloakClientToOptionalScopeRelProperties()
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@dataclass(frozen=True)
|
|
119
|
+
class KeycloakClientToServiceAccountRelProperties(CartographyRelProperties):
|
|
120
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass(frozen=True)
|
|
124
|
+
# (:KeycloakClient)-[:HAS_SERVICE_ACCOUNT]->(:KeycloakUser)
|
|
125
|
+
class KeycloakClientToServiceAccountRel(CartographyRelSchema):
|
|
126
|
+
target_node_label: str = "KeycloakUser"
|
|
127
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
128
|
+
{"id": PropertyRef("_service_account_user_id")},
|
|
129
|
+
)
|
|
130
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
131
|
+
rel_label: str = "HAS_SERVICE_ACCOUNT"
|
|
132
|
+
properties: KeycloakClientToServiceAccountRelProperties = (
|
|
133
|
+
KeycloakClientToServiceAccountRelProperties()
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@dataclass(frozen=True)
|
|
138
|
+
class KeycloakClientSchema(CartographyNodeSchema):
|
|
139
|
+
label: str = "KeycloakClient"
|
|
140
|
+
properties: KeycloakClientNodeProperties = KeycloakClientNodeProperties()
|
|
141
|
+
sub_resource_relationship: KeycloakClientToRealmRel = KeycloakClientToRealmRel()
|
|
142
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
143
|
+
[
|
|
144
|
+
KeycloakClientToDefaultScopeRel(),
|
|
145
|
+
KeycloakClientToOptionalScopeRel(),
|
|
146
|
+
KeycloakClientToServiceAccountRel(),
|
|
147
|
+
]
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# The following relationships are MatchLinks to enable batch loading with rel properties
|
|
152
|
+
@dataclass(frozen=True)
|
|
153
|
+
class KeycloakClientToFlowRelProperties(CartographyRelProperties):
|
|
154
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
155
|
+
flow_name: PropertyRef = PropertyRef("flow_name")
|
|
156
|
+
default_flow: PropertyRef = PropertyRef("default_flow")
|
|
157
|
+
# Mandatory fields for MatchLinks
|
|
158
|
+
_sub_resource_label: PropertyRef = PropertyRef(
|
|
159
|
+
"_sub_resource_label", set_in_kwargs=True
|
|
160
|
+
)
|
|
161
|
+
_sub_resource_id: PropertyRef = PropertyRef("_sub_resource_id", set_in_kwargs=True)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
@dataclass(frozen=True)
|
|
165
|
+
# (:KeycloakClient)-[:USES]->(:KeycloakAuthenticationFlow)
|
|
166
|
+
class KeycloakClientToFlowMatchLink(CartographyRelSchema):
|
|
167
|
+
source_node_label: str = "KeycloakClient"
|
|
168
|
+
source_node_matcher: SourceNodeMatcher = make_source_node_matcher(
|
|
169
|
+
{"id": PropertyRef("client_id")},
|
|
170
|
+
)
|
|
171
|
+
target_node_label: str = "KeycloakAuthenticationFlow"
|
|
172
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
173
|
+
{"id": PropertyRef("flow_id")},
|
|
174
|
+
)
|
|
175
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
176
|
+
rel_label: str = "USES"
|
|
177
|
+
properties: KeycloakClientToFlowRelProperties = KeycloakClientToFlowRelProperties()
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class KeycloakGroupNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
name: PropertyRef = PropertyRef("name")
|
|
18
|
+
description: PropertyRef = PropertyRef("description")
|
|
19
|
+
path: PropertyRef = PropertyRef("path")
|
|
20
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class KeycloakGroupToRealmRelProperties(CartographyRelProperties):
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
# (:KeycloakGroup)<-[:RESOURCE]-(:KeycloakRealm)
|
|
30
|
+
class KeycloakGroupToRealmRel(CartographyRelSchema):
|
|
31
|
+
target_node_label: str = "KeycloakRealm"
|
|
32
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
33
|
+
{"name": PropertyRef("REALM", set_in_kwargs=True)},
|
|
34
|
+
)
|
|
35
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
36
|
+
rel_label: str = "RESOURCE"
|
|
37
|
+
properties: KeycloakGroupToRealmRelProperties = KeycloakGroupToRealmRelProperties()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class KeycloakGroupToGroupRelProperties(CartographyRelProperties):
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
# (:KeycloakGroup)-[:SUBGROUP_OF]->(:KeycloakGroup)
|
|
47
|
+
class KeycloakGroupToGroupRel(CartographyRelSchema):
|
|
48
|
+
target_node_label: str = "KeycloakGroup"
|
|
49
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
50
|
+
{"id": PropertyRef("parentId")},
|
|
51
|
+
)
|
|
52
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
53
|
+
rel_label: str = "SUBGROUP_OF"
|
|
54
|
+
properties: KeycloakGroupToGroupRelProperties = KeycloakGroupToGroupRelProperties()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
class KeycloakGroupToUserRelProperties(CartographyRelProperties):
|
|
59
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(frozen=True)
|
|
63
|
+
# (:KeycloakGroup)<-[:MEMBER_OF]-(:KeycloakUser)
|
|
64
|
+
class KeycloakGroupToUserRel(CartographyRelSchema):
|
|
65
|
+
target_node_label: str = "KeycloakUser"
|
|
66
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
67
|
+
{"id": PropertyRef("_member_ids", one_to_many=True)},
|
|
68
|
+
)
|
|
69
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
70
|
+
rel_label: str = "MEMBER_OF"
|
|
71
|
+
properties: KeycloakGroupToUserRelProperties = KeycloakGroupToUserRelProperties()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class KeycloakGroupToRoleRelProperties(CartographyRelProperties):
|
|
76
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
# (:KeycloakGroup)-[:GRANTS]->(:KeycloakRole)
|
|
81
|
+
class KeycloakGroupToRoleRel(CartographyRelSchema):
|
|
82
|
+
target_node_label: str = "KeycloakRole"
|
|
83
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
84
|
+
{
|
|
85
|
+
"name": PropertyRef("_roles", one_to_many=True),
|
|
86
|
+
"realm": PropertyRef("REALM", set_in_kwargs=True),
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
90
|
+
rel_label: str = "GRANTS"
|
|
91
|
+
properties: KeycloakGroupToRoleRelProperties = KeycloakGroupToRoleRelProperties()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dataclass(frozen=True)
|
|
95
|
+
class KeycloakGroupSchema(CartographyNodeSchema):
|
|
96
|
+
label: str = "KeycloakGroup"
|
|
97
|
+
properties: KeycloakGroupNodeProperties = KeycloakGroupNodeProperties()
|
|
98
|
+
sub_resource_relationship: KeycloakGroupToRealmRel = KeycloakGroupToRealmRel()
|
|
99
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
100
|
+
[KeycloakGroupToGroupRel(), KeycloakGroupToUserRel(), KeycloakGroupToRoleRel()]
|
|
101
|
+
)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
|
+
from cartography.models.core.relationships import LinkDirection
|
|
9
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
11
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class KeycloakIdentityProviderNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("internalId")
|
|
17
|
+
alias: PropertyRef = PropertyRef("alias", extra_index=True)
|
|
18
|
+
display_name: PropertyRef = PropertyRef("displayName")
|
|
19
|
+
provider_id: PropertyRef = PropertyRef("providerId")
|
|
20
|
+
enabled: PropertyRef = PropertyRef("enabled")
|
|
21
|
+
update_profile_first_login_mode: PropertyRef = PropertyRef(
|
|
22
|
+
"updateProfileFirstLoginMode"
|
|
23
|
+
)
|
|
24
|
+
trust_email: PropertyRef = PropertyRef("trustEmail")
|
|
25
|
+
store_token: PropertyRef = PropertyRef("storeToken")
|
|
26
|
+
add_read_token_role_on_create: PropertyRef = PropertyRef("addReadTokenRoleOnCreate")
|
|
27
|
+
authenticate_by_default: PropertyRef = PropertyRef("authenticateByDefault")
|
|
28
|
+
link_only: PropertyRef = PropertyRef("linkOnly")
|
|
29
|
+
hide_on_login: PropertyRef = PropertyRef("hideOnLogin")
|
|
30
|
+
first_broker_login_flow_alias: PropertyRef = PropertyRef(
|
|
31
|
+
"firstBrokerLoginFlowAlias"
|
|
32
|
+
)
|
|
33
|
+
post_broker_login_flow_alias: PropertyRef = PropertyRef("postBrokerLoginFlowAlias")
|
|
34
|
+
organization_id: PropertyRef = PropertyRef("organizationId")
|
|
35
|
+
update_profile_first_login: PropertyRef = PropertyRef("updateProfileFirstLogin")
|
|
36
|
+
config_sync_mode: PropertyRef = PropertyRef("config.syncMode")
|
|
37
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class KeycloakIdentityProviderToRealmRelProperties(CartographyRelProperties):
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
# (:KeycloakIdentityProvider)<-[:RESOURCE]-(:KeycloakRealm)
|
|
47
|
+
class KeycloakIdentityProviderToRealmRel(CartographyRelSchema):
|
|
48
|
+
target_node_label: str = "KeycloakRealm"
|
|
49
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
50
|
+
{"name": PropertyRef("REALM", set_in_kwargs=True)},
|
|
51
|
+
)
|
|
52
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
53
|
+
rel_label: str = "RESOURCE"
|
|
54
|
+
properties: KeycloakIdentityProviderToRealmRelProperties = (
|
|
55
|
+
KeycloakIdentityProviderToRealmRelProperties()
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@dataclass(frozen=True)
|
|
60
|
+
class KeycloakIdentityProviderToUserRelProperties(CartographyRelProperties):
|
|
61
|
+
lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
# (:KeycloakIdentityProvider)<-[:HAS_IDENTITY]-(:KeycloakUser)
|
|
66
|
+
class KeycloakIdentityProviderToUserRel(CartographyRelSchema):
|
|
67
|
+
target_node_label: str = "KeycloakUser"
|
|
68
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
69
|
+
{"id": PropertyRef("_member_ids", one_to_many=True)},
|
|
70
|
+
)
|
|
71
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
72
|
+
rel_label: str = "HAS_IDENTITY"
|
|
73
|
+
properties: KeycloakIdentityProviderToUserRelProperties = (
|
|
74
|
+
KeycloakIdentityProviderToUserRelProperties()
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@dataclass(frozen=True)
|
|
79
|
+
class KeycloakIdentityProviderSchema(CartographyNodeSchema):
|
|
80
|
+
label: str = "KeycloakIdentityProvider"
|
|
81
|
+
properties: KeycloakIdentityProviderNodeProperties = (
|
|
82
|
+
KeycloakIdentityProviderNodeProperties()
|
|
83
|
+
)
|
|
84
|
+
sub_resource_relationship: KeycloakIdentityProviderToRealmRel = (
|
|
85
|
+
KeycloakIdentityProviderToRealmRel()
|
|
86
|
+
)
|
|
87
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
88
|
+
[KeycloakIdentityProviderToUserRel()],
|
|
89
|
+
)
|