@backstage/plugin-catalog-backend-module-msgraph 0.3.4-next.0 → 0.4.0
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.
- package/CHANGELOG.md +218 -0
- package/README.md +69 -91
- package/config.d.ts +171 -2
- package/dist/index.cjs.js +109 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +66 -13
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,223 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend-module-msgraph
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a145672f0f: Align `msgraph` plugin's entity provider config with other providers. **Deprecated** entity processor as well as previous config.
|
|
8
|
+
|
|
9
|
+
You will see warning at the log output until you migrate to the new setup.
|
|
10
|
+
All deprecated parts will be removed eventually after giving some time to migrate.
|
|
11
|
+
|
|
12
|
+
Please find information on how to migrate your current setup to the new one below.
|
|
13
|
+
|
|
14
|
+
**Migration Guide:**
|
|
15
|
+
|
|
16
|
+
There were two different way on how to use the msgraph plugin: processor or provider.
|
|
17
|
+
|
|
18
|
+
Previous registration for the processor:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// packages/backend/src/plugins/catalog.ts
|
|
22
|
+
builder.addProcessor(
|
|
23
|
+
MicrosoftGraphOrgReaderProcessor.fromConfig(env.config, {
|
|
24
|
+
logger: env.logger,
|
|
25
|
+
// [...]
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Previous registration when using the provider:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// packages/backend/src/plugins/catalog.ts
|
|
34
|
+
builder.addEntityProvider(
|
|
35
|
+
MicrosoftGraphOrgEntityProvider.fromConfig(env.config, {
|
|
36
|
+
id: 'https://graph.microsoft.com/v1.0',
|
|
37
|
+
target: 'https://graph.microsoft.com/v1.0',
|
|
38
|
+
logger: env.logger,
|
|
39
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
40
|
+
frequency: { minutes: 30 },
|
|
41
|
+
timeout: { minutes: 3 },
|
|
42
|
+
}),
|
|
43
|
+
// [...]
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Previous configuration as used for both:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
# app-config.yaml
|
|
52
|
+
catalog:
|
|
53
|
+
processors:
|
|
54
|
+
microsoftGraphOrg:
|
|
55
|
+
providers:
|
|
56
|
+
- target: https://graph.microsoft.com/v1.0
|
|
57
|
+
# [...]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Replacement:**
|
|
61
|
+
|
|
62
|
+
Please check https://github.com/backstage/backstage/blob/master/plugins/catalog-backend-module-msgraph/README.md for the complete documentation of all configuration options (config as well as registration of the provider).
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
# app-config.yaml
|
|
66
|
+
catalog:
|
|
67
|
+
providers:
|
|
68
|
+
microsoftGraphOrg:
|
|
69
|
+
# In case you used the deprecated configuration with the entity provider
|
|
70
|
+
# using the value of `target` will keep the same location key for all
|
|
71
|
+
providerId: # some stable ID which will be used as part of the location key for all ingested data
|
|
72
|
+
target: https://graph.microsoft.com/v1.0
|
|
73
|
+
# [...]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// packages/backend/src/plugins/catalog.ts
|
|
78
|
+
builder.addEntityProvider(
|
|
79
|
+
MicrosoftGraphOrgEntityProvider.fromConfig(env.config, {
|
|
80
|
+
logger: env.logger,
|
|
81
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
82
|
+
frequency: { minutes: 30 },
|
|
83
|
+
timeout: { minutes: 3 },
|
|
84
|
+
}),
|
|
85
|
+
// [...]
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
In case you've used multiple entity providers before
|
|
91
|
+
**and** you had different transformers for each of them
|
|
92
|
+
you can provide these directly at the one `fromConfig` call
|
|
93
|
+
by passing a Record with the provider ID as key.
|
|
94
|
+
|
|
95
|
+
- b8ebecd100: Microsoft Graph plugin can supports many more options for authenticating with the Microsoft Graph API.
|
|
96
|
+
Previously only ClientId/ClientSecret was supported, but now all the authentication options of `DefaultAzureCredential` from `@azure/identity` are supported.
|
|
97
|
+
Including Managed Identity, Client Certificate, Azure CLI and VS Code.
|
|
98
|
+
|
|
99
|
+
If `clientId` and `clientSecret` are specified in configuration, the plugin behaves the same way as before.
|
|
100
|
+
If these fields are omitted, the plugin uses `DefaultAzureCredential` to automatically determine the best authentication method.
|
|
101
|
+
This is particularly useful for local development environments - the default configuration will try to use existing credentials from Visual Studio Code, Azure CLI and Azure PowerShell, without the user needing to configure any credentials in app-config.yaml
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- a70869e775: Updated dependency `msw` to `^0.43.0`.
|
|
106
|
+
- 8006d0f9bf: Updated dependency `msw` to `^0.44.0`.
|
|
107
|
+
- Updated dependencies
|
|
108
|
+
- @backstage/plugin-catalog-backend@1.3.0
|
|
109
|
+
- @backstage/catalog-model@1.1.0
|
|
110
|
+
- @backstage/backend-tasks@0.3.3
|
|
111
|
+
|
|
112
|
+
## 0.4.0-next.2
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- a70869e775: Updated dependency `msw` to `^0.43.0`.
|
|
117
|
+
- Updated dependencies
|
|
118
|
+
- @backstage/plugin-catalog-backend@1.3.0-next.3
|
|
119
|
+
- @backstage/backend-tasks@0.3.3-next.3
|
|
120
|
+
- @backstage/catalog-model@1.1.0-next.3
|
|
121
|
+
|
|
122
|
+
## 0.4.0-next.1
|
|
123
|
+
|
|
124
|
+
### Minor Changes
|
|
125
|
+
|
|
126
|
+
- a145672f0f: Align `msgraph` plugin's entity provider config with other providers. **Deprecated** entity processor as well as previous config.
|
|
127
|
+
|
|
128
|
+
You will see warning at the log output until you migrate to the new setup.
|
|
129
|
+
All deprecated parts will be removed eventually after giving some time to migrate.
|
|
130
|
+
|
|
131
|
+
Please find information on how to migrate your current setup to the new one below.
|
|
132
|
+
|
|
133
|
+
**Migration Guide:**
|
|
134
|
+
|
|
135
|
+
There were two different way on how to use the msgraph plugin: processor or provider.
|
|
136
|
+
|
|
137
|
+
Previous registration for the processor:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// packages/backend/src/plugins/catalog.ts
|
|
141
|
+
builder.addProcessor(
|
|
142
|
+
MicrosoftGraphOrgReaderProcessor.fromConfig(env.config, {
|
|
143
|
+
logger: env.logger,
|
|
144
|
+
// [...]
|
|
145
|
+
}),
|
|
146
|
+
);
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Previous registration when using the provider:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// packages/backend/src/plugins/catalog.ts
|
|
153
|
+
builder.addEntityProvider(
|
|
154
|
+
MicrosoftGraphOrgEntityProvider.fromConfig(env.config, {
|
|
155
|
+
id: 'https://graph.microsoft.com/v1.0',
|
|
156
|
+
target: 'https://graph.microsoft.com/v1.0',
|
|
157
|
+
logger: env.logger,
|
|
158
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
159
|
+
frequency: { minutes: 30 },
|
|
160
|
+
timeout: { minutes: 3 },
|
|
161
|
+
}),
|
|
162
|
+
// [...]
|
|
163
|
+
}),
|
|
164
|
+
);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Previous configuration as used for both:
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
# app-config.yaml
|
|
171
|
+
catalog:
|
|
172
|
+
processors:
|
|
173
|
+
microsoftGraphOrg:
|
|
174
|
+
providers:
|
|
175
|
+
- target: https://graph.microsoft.com/v1.0
|
|
176
|
+
# [...]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Replacement:**
|
|
180
|
+
|
|
181
|
+
Please check https://github.com/backstage/backstage/blob/master/plugins/catalog-backend-module-msgraph/README.md for the complete documentation of all configuration options (config as well as registration of the provider).
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
# app-config.yaml
|
|
185
|
+
catalog:
|
|
186
|
+
providers:
|
|
187
|
+
microsoftGraphOrg:
|
|
188
|
+
# In case you used the deprecated configuration with the entity provider
|
|
189
|
+
# using the value of `target` will keep the same location key for all
|
|
190
|
+
providerId: # some stable ID which will be used as part of the location key for all ingested data
|
|
191
|
+
target: https://graph.microsoft.com/v1.0
|
|
192
|
+
# [...]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// packages/backend/src/plugins/catalog.ts
|
|
197
|
+
builder.addEntityProvider(
|
|
198
|
+
MicrosoftGraphOrgEntityProvider.fromConfig(env.config, {
|
|
199
|
+
logger: env.logger,
|
|
200
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
201
|
+
frequency: { minutes: 30 },
|
|
202
|
+
timeout: { minutes: 3 },
|
|
203
|
+
}),
|
|
204
|
+
// [...]
|
|
205
|
+
}),
|
|
206
|
+
);
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
In case you've used multiple entity providers before
|
|
210
|
+
**and** you had different transformers for each of them
|
|
211
|
+
you can provide these directly at the one `fromConfig` call
|
|
212
|
+
by passing a Record with the provider ID as key.
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- Updated dependencies
|
|
217
|
+
- @backstage/catalog-model@1.1.0-next.2
|
|
218
|
+
- @backstage/backend-tasks@0.3.3-next.2
|
|
219
|
+
- @backstage/plugin-catalog-backend@1.2.1-next.2
|
|
220
|
+
|
|
3
221
|
## 0.3.4-next.0
|
|
4
222
|
|
|
5
223
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,85 +1,93 @@
|
|
|
1
1
|
# Catalog Backend Module for Microsoft Graph
|
|
2
2
|
|
|
3
|
-
This is an extension module to the `plugin-catalog-backend` plugin, providing a
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
processor is useful if you want to import users and groups from Azure Active
|
|
7
|
-
Directory or Office 365.
|
|
3
|
+
This is an extension module to the `plugin-catalog-backend` plugin, providing a `MicrosoftGraphOrgEntityProvider`
|
|
4
|
+
that can be used to ingest organization data from the Microsoft Graph API.
|
|
5
|
+
This provider is useful if you want to import users and groups from Azure Active Directory or Office 365.
|
|
8
6
|
|
|
9
7
|
## Getting Started
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
If you want groups and users deleted from the source to be automatically deleted
|
|
13
|
-
from Backstage, choose the entity provider.
|
|
9
|
+
1. Choose your authentication method - all methods supported by [DefaultAzureCredential](https://docs.microsoft.com/en-us/javascript/api/overview/azure/identity-readme?view=azure-node-latest#defaultazurecredential)
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(if you still run into errors about insufficient privileges, add
|
|
19
|
-
`Team.ReadBasic.All` and `TeamMember.Read.All` too).
|
|
11
|
+
- For local dev, use Azure CLI, Azure PowerShell or Visual Studio Code for authentication
|
|
12
|
+
- If your infrastructure supports Managed Identity, use that
|
|
13
|
+
- Otherwise use an App Registration
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
1. If using Managed Identity or App Registration for authentication, grant the following application permissions (not delegated)
|
|
16
|
+
|
|
17
|
+
- `GroupMember.Read.All`
|
|
18
|
+
- `User.Read.All`
|
|
19
|
+
|
|
20
|
+
1. Configure the entity provider:
|
|
22
21
|
|
|
23
22
|
```yaml
|
|
24
23
|
# app-config.yaml
|
|
25
24
|
catalog:
|
|
26
|
-
|
|
25
|
+
providers:
|
|
27
26
|
microsoftGraphOrg:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
providerId:
|
|
28
|
+
target: https://graph.microsoft.com/v1.0
|
|
29
|
+
authority: https://login.microsoftonline.com
|
|
30
|
+
# If you don't know you tenantId, you can use Microsoft Graph Explorer
|
|
31
|
+
# to query it
|
|
32
|
+
tenantId: ${AZURE_TENANT_ID}
|
|
33
|
+
# Optional ClientId and ClientSecret if you don't want to use `DefaultAzureCredential`
|
|
34
|
+
# for authentication
|
|
35
|
+
# Client Id and Secret can be created under Certificates & secrets in
|
|
36
|
+
# the App registration in the Microsoft Azure Portal.
|
|
37
|
+
clientId: ${AZURE_CLIENT_ID}
|
|
38
|
+
clientSecret: ${AZURE_CLIENT_SECRET}
|
|
39
|
+
# Optional mode for querying which defaults to "basic".
|
|
40
|
+
# By default, the Microsoft Graph API only provides the basic feature set
|
|
41
|
+
# for querying. Certain features are limited to advanced querying capabilities.
|
|
42
|
+
# (See https://docs.microsoft.com/en-us/graph/aad-advanced-queries)
|
|
43
|
+
queryMode: basic # basic | advanced
|
|
44
|
+
# Optional configuration block
|
|
45
|
+
user:
|
|
43
46
|
# Optional parameter to include the expanded resource or collection referenced
|
|
44
47
|
# by a single relationship (navigation property) in your results.
|
|
45
48
|
# Only one relationship can be expanded in a single request.
|
|
46
49
|
# See https://docs.microsoft.com/en-us/graph/query-parameters#expand-parameter
|
|
47
50
|
# Can be combined with userGroupMember[...] instead of userFilter.
|
|
48
|
-
|
|
51
|
+
expand: manager
|
|
49
52
|
# Optional filter for user, see Microsoft Graph API for the syntax
|
|
50
53
|
# See https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#properties
|
|
51
54
|
# and for the syntax https://docs.microsoft.com/en-us/graph/query-parameters#filter-parameter
|
|
52
55
|
# This and userGroupMemberFilter are mutually exclusive, only one can be specified
|
|
53
|
-
|
|
56
|
+
filter: accountEnabled eq true and userType eq 'member'
|
|
57
|
+
# Optional configuration block
|
|
58
|
+
userGroupMember:
|
|
54
59
|
# Optional filter for users, use group membership to get users.
|
|
55
60
|
# (Filtered groups and fetch their members.)
|
|
56
61
|
# This and userFilter are mutually exclusive, only one can be specified
|
|
57
62
|
# See https://docs.microsoft.com/en-us/graph/search-query-parameter
|
|
58
|
-
|
|
63
|
+
filter: "displayName eq 'Backstage Users'"
|
|
64
|
+
# Optional search for users, use group membership to get users.
|
|
65
|
+
# (Search for groups and fetch their members.)
|
|
66
|
+
# This and userFilter are mutually exclusive, only one can be specified
|
|
67
|
+
search: '"description:One" AND ("displayName:Video" OR "displayName:Drive")'
|
|
68
|
+
# Optional configuration block
|
|
69
|
+
group:
|
|
59
70
|
# Optional parameter to include the expanded resource or collection referenced
|
|
60
71
|
# by a single relationship (navigation property) in your results.
|
|
61
72
|
# Only one relationship can be expanded in a single request.
|
|
62
73
|
# See https://docs.microsoft.com/en-us/graph/query-parameters#expand-parameter
|
|
63
74
|
# Can be combined with userGroupMember[...] instead of userFilter.
|
|
64
|
-
|
|
65
|
-
# Optional search for users, use group membership to get users.
|
|
66
|
-
# (Search for groups and fetch their members.)
|
|
67
|
-
# This and userFilter are mutually exclusive, only one can be specified
|
|
68
|
-
userGroupMemberSearch: '"description:One" AND ("displayName:Video" OR "displayName:Drive")'
|
|
75
|
+
expand: member
|
|
69
76
|
# Optional filter for group, see Microsoft Graph API for the syntax
|
|
70
77
|
# See https://docs.microsoft.com/en-us/graph/api/resources/group?view=graph-rest-1.0#properties
|
|
71
|
-
|
|
78
|
+
filter: securityEnabled eq false and mailEnabled eq true and groupTypes/any(c:c+eq+'Unified')
|
|
72
79
|
# Optional search for groups, see Microsoft Graph API for the syntax
|
|
73
80
|
# See https://docs.microsoft.com/en-us/graph/search-query-parameter
|
|
74
|
-
|
|
75
|
-
# Optional select for groups, this will allow you work with schemaExtensions
|
|
81
|
+
search: '"description:One" AND ("displayName:Video" OR "displayName:Drive")'
|
|
82
|
+
# Optional select for groups, this will allow you work with schemaExtensions
|
|
83
|
+
# in order to add extra information to your groups that can be used on you custom groupTransformers
|
|
76
84
|
# See https://docs.microsoft.com/en-us/graph/api/resources/schemaextension?view=graph-rest-1.0
|
|
77
|
-
|
|
85
|
+
select: ['id', 'displayName', 'description']
|
|
78
86
|
```
|
|
79
87
|
|
|
80
|
-
`
|
|
88
|
+
`user.filter` and `userGroupMember.filter` are mutually exclusive, only one can be provided. If both are provided, an error will be thrown.
|
|
81
89
|
|
|
82
|
-
By default, all users are loaded. If you want to filter users based on their attributes, use `
|
|
90
|
+
By default, all users are loaded. If you want to filter users based on their attributes, use `user.filter`. `userGroupMember.filter` can be used if you want to load users based on their group membership.
|
|
83
91
|
|
|
84
92
|
3. The package is not installed by default, therefore you have to add a
|
|
85
93
|
dependency to `@backstage/plugin-catalog-backend-module-msgraph` to your
|
|
@@ -90,15 +98,12 @@ By default, all users are loaded. If you want to filter users based on their att
|
|
|
90
98
|
yarn add --cwd packages/backend @backstage/plugin-catalog-backend-module-msgraph
|
|
91
99
|
```
|
|
92
100
|
|
|
93
|
-
### Using the Entity Provider
|
|
94
|
-
|
|
95
101
|
4. The `MicrosoftGraphOrgEntityProvider` is not registered by default, so you
|
|
96
102
|
have to register it in the catalog plugin. Pass the target to reference a
|
|
97
103
|
provider from the configuration.
|
|
98
104
|
|
|
99
105
|
```diff
|
|
100
106
|
// packages/backend/src/plugins/catalog.ts
|
|
101
|
-
+import { Duration } from 'luxon';
|
|
102
107
|
+import { MicrosoftGraphOrgEntityProvider } from '@backstage/plugin-catalog-backend-module-msgraph';
|
|
103
108
|
|
|
104
109
|
export default async function createPlugin(
|
|
@@ -106,53 +111,22 @@ yarn add --cwd packages/backend @backstage/plugin-catalog-backend-module-msgraph
|
|
|
106
111
|
): Promise<Router> {
|
|
107
112
|
const builder = await CatalogBuilder.create(env);
|
|
108
113
|
|
|
109
|
-
+ // The target parameter below needs to match one of the providers' target
|
|
110
|
-
+ // value specified in your app-config (see above).
|
|
111
114
|
+ builder.addEntityProvider(
|
|
112
115
|
+ MicrosoftGraphOrgEntityProvider.fromConfig(env.config, {
|
|
113
|
-
+ id: 'production',
|
|
114
|
-
+ target: 'https://graph.microsoft.com/v1.0',
|
|
115
116
|
+ logger: env.logger,
|
|
116
117
|
+ schedule: env.scheduler.createScheduledTaskRunner({
|
|
117
|
-
+ frequency:
|
|
118
|
-
+ timeout:
|
|
118
|
+
+ frequency: { hours: 1 },
|
|
119
|
+
+ timeout: { minutes: 50 },
|
|
120
|
+
+ initialDelay: { seconds: 15}
|
|
119
121
|
+ }),
|
|
120
122
|
+ }),
|
|
121
123
|
+ );
|
|
122
124
|
```
|
|
123
125
|
|
|
124
|
-
### Using the Processor
|
|
125
|
-
|
|
126
|
-
4. The `MicrosoftGraphOrgReaderProcessor` is not registered by default, so you
|
|
127
|
-
have to register it in the catalog plugin:
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
// packages/backend/src/plugins/catalog.ts
|
|
131
|
-
builder.addProcessor(
|
|
132
|
-
MicrosoftGraphOrgReaderProcessor.fromConfig(env.config, {
|
|
133
|
-
logger: env.logger,
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
5. Add a location that ingests from Microsoft Graph:
|
|
139
|
-
|
|
140
|
-
```yaml
|
|
141
|
-
# app-config.yaml
|
|
142
|
-
catalog:
|
|
143
|
-
locations:
|
|
144
|
-
- type: microsoft-graph-org
|
|
145
|
-
target: https://graph.microsoft.com/v1.0
|
|
146
|
-
rules:
|
|
147
|
-
- allow: [Group, User]
|
|
148
|
-
…
|
|
149
|
-
```
|
|
150
|
-
|
|
151
126
|
## Customize the Processor or Entity Provider
|
|
152
127
|
|
|
153
|
-
In case you want to customize the ingested entities,
|
|
154
|
-
|
|
155
|
-
groups and the organization.
|
|
128
|
+
In case you want to customize the ingested entities, the `MicrosoftGraphOrgEntityProvider`
|
|
129
|
+
allows to pass transformers for users, groups and the organization.
|
|
156
130
|
|
|
157
131
|
1. Create a transformer:
|
|
158
132
|
|
|
@@ -179,13 +153,17 @@ export async function myGroupTransformer(
|
|
|
179
153
|
}
|
|
180
154
|
```
|
|
181
155
|
|
|
182
|
-
2.
|
|
156
|
+
2. Add the transformer:
|
|
183
157
|
|
|
184
|
-
```
|
|
185
|
-
builder.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
158
|
+
```diff
|
|
159
|
+
builder.addEntityProvider(
|
|
160
|
+
MicrosoftGraphOrgEntityProvider.fromConfig(env.config, {
|
|
161
|
+
logger: env.logger,
|
|
162
|
+
schedule: env.scheduler.createScheduledTaskRunner({
|
|
163
|
+
frequency: { minutes: 5 },
|
|
164
|
+
timeout: { minutes: 3 },
|
|
165
|
+
}),
|
|
166
|
+
+ groupTransformer: myGroupTransformer,
|
|
167
|
+
}),
|
|
168
|
+
);
|
|
191
169
|
```
|
package/config.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface Config {
|
|
|
25
25
|
processors?: {
|
|
26
26
|
/**
|
|
27
27
|
* MicrosoftGraphOrgReaderProcessor configuration
|
|
28
|
+
* @deprecated Use `catalog.providers.microsoftGraphOrg` instead.
|
|
28
29
|
*/
|
|
29
30
|
microsoftGraphOrg?: {
|
|
30
31
|
/**
|
|
@@ -49,13 +50,13 @@ export interface Config {
|
|
|
49
50
|
/**
|
|
50
51
|
* The OAuth client ID to use for authenticating requests.
|
|
51
52
|
*/
|
|
52
|
-
clientId
|
|
53
|
+
clientId?: string;
|
|
53
54
|
/**
|
|
54
55
|
* The OAuth client secret to use for authenticating requests.
|
|
55
56
|
*
|
|
56
57
|
* @visibility secret
|
|
57
58
|
*/
|
|
58
|
-
clientSecret
|
|
59
|
+
clientSecret?: string;
|
|
59
60
|
|
|
60
61
|
// TODO: Consider not making these config options and pass them in the
|
|
61
62
|
// constructor instead. They are probably not environment specific, so
|
|
@@ -102,5 +103,173 @@ export interface Config {
|
|
|
102
103
|
}>;
|
|
103
104
|
};
|
|
104
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* List of provider-specific options and attributes
|
|
108
|
+
*/
|
|
109
|
+
providers?: {
|
|
110
|
+
/**
|
|
111
|
+
* MicrosoftGraphOrgEntityProvider configuration.
|
|
112
|
+
*/
|
|
113
|
+
microsoftGraphOrg?:
|
|
114
|
+
| {
|
|
115
|
+
/**
|
|
116
|
+
* The prefix of the target that this matches on, e.g.
|
|
117
|
+
* "https://graph.microsoft.com/v1.0", with no trailing slash.
|
|
118
|
+
*/
|
|
119
|
+
target: string;
|
|
120
|
+
/**
|
|
121
|
+
* The auth authority used.
|
|
122
|
+
*
|
|
123
|
+
* Default value "https://login.microsoftonline.com"
|
|
124
|
+
*/
|
|
125
|
+
authority?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The tenant whose org data we are interested in.
|
|
128
|
+
*/
|
|
129
|
+
tenantId: string;
|
|
130
|
+
/**
|
|
131
|
+
* The OAuth client ID to use for authenticating requests.
|
|
132
|
+
*/
|
|
133
|
+
clientId?: string;
|
|
134
|
+
/**
|
|
135
|
+
* The OAuth client secret to use for authenticating requests.
|
|
136
|
+
*
|
|
137
|
+
* @visibility secret
|
|
138
|
+
*/
|
|
139
|
+
clientSecret?: string;
|
|
140
|
+
|
|
141
|
+
user?: {
|
|
142
|
+
/**
|
|
143
|
+
* The "expand" argument to apply to users.
|
|
144
|
+
*
|
|
145
|
+
* E.g. "manager".
|
|
146
|
+
*/
|
|
147
|
+
expand?: string;
|
|
148
|
+
/**
|
|
149
|
+
* The filter to apply to extract users.
|
|
150
|
+
*
|
|
151
|
+
* E.g. "accountEnabled eq true and userType eq 'member'"
|
|
152
|
+
*/
|
|
153
|
+
filter?: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
group?: {
|
|
157
|
+
/**
|
|
158
|
+
* The "expand" argument to apply to groups.
|
|
159
|
+
*
|
|
160
|
+
* E.g. "member".
|
|
161
|
+
*/
|
|
162
|
+
expand?: string;
|
|
163
|
+
/**
|
|
164
|
+
* The filter to apply to extract groups.
|
|
165
|
+
*
|
|
166
|
+
* E.g. "securityEnabled eq false and mailEnabled eq true"
|
|
167
|
+
*/
|
|
168
|
+
filter?: string;
|
|
169
|
+
/**
|
|
170
|
+
* The search criteria to apply to extract users by groups memberships.
|
|
171
|
+
*
|
|
172
|
+
* E.g. "\"displayName:-team\"" would only match groups which contain '-team'
|
|
173
|
+
*/
|
|
174
|
+
search?: string;
|
|
175
|
+
/**
|
|
176
|
+
* The fields to be fetched on query.
|
|
177
|
+
*
|
|
178
|
+
* E.g. ["id", "displayName", "description"]
|
|
179
|
+
*/
|
|
180
|
+
select?: string[];
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
userGroupMember?: {
|
|
184
|
+
/**
|
|
185
|
+
* The filter to apply to extract users by groups memberships.
|
|
186
|
+
*
|
|
187
|
+
* E.g. "displayName eq 'Backstage Users'"
|
|
188
|
+
*/
|
|
189
|
+
filter?: string;
|
|
190
|
+
/**
|
|
191
|
+
* The search criteria to apply to extract groups.
|
|
192
|
+
*
|
|
193
|
+
* E.g. "\"displayName:-team\"" would only match groups which contain '-team'
|
|
194
|
+
*/
|
|
195
|
+
search?: string;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
| Record<
|
|
199
|
+
string,
|
|
200
|
+
{
|
|
201
|
+
/**
|
|
202
|
+
* The prefix of the target that this matches on, e.g.
|
|
203
|
+
* "https://graph.microsoft.com/v1.0", with no trailing slash.
|
|
204
|
+
*/
|
|
205
|
+
target: string;
|
|
206
|
+
/**
|
|
207
|
+
* The auth authority used.
|
|
208
|
+
*
|
|
209
|
+
* Default value "https://login.microsoftonline.com"
|
|
210
|
+
*/
|
|
211
|
+
authority?: string;
|
|
212
|
+
/**
|
|
213
|
+
* The tenant whose org data we are interested in.
|
|
214
|
+
*/
|
|
215
|
+
tenantId: string;
|
|
216
|
+
/**
|
|
217
|
+
* The OAuth client ID to use for authenticating requests.
|
|
218
|
+
*/
|
|
219
|
+
clientId: string;
|
|
220
|
+
/**
|
|
221
|
+
* The OAuth client secret to use for authenticating requests.
|
|
222
|
+
*
|
|
223
|
+
* @visibility secret
|
|
224
|
+
*/
|
|
225
|
+
clientSecret: string;
|
|
226
|
+
|
|
227
|
+
user?: {
|
|
228
|
+
/**
|
|
229
|
+
* The filter to apply to extract users.
|
|
230
|
+
*
|
|
231
|
+
* E.g. "accountEnabled eq true and userType eq 'member'"
|
|
232
|
+
*/
|
|
233
|
+
filter?: string;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
group?: {
|
|
237
|
+
/**
|
|
238
|
+
* The filter to apply to extract groups.
|
|
239
|
+
*
|
|
240
|
+
* E.g. "securityEnabled eq false and mailEnabled eq true"
|
|
241
|
+
*/
|
|
242
|
+
filter?: string;
|
|
243
|
+
/**
|
|
244
|
+
* The search criteria to apply to extract users by groups memberships.
|
|
245
|
+
*
|
|
246
|
+
* E.g. "\"displayName:-team\"" would only match groups which contain '-team'
|
|
247
|
+
*/
|
|
248
|
+
search?: string;
|
|
249
|
+
/**
|
|
250
|
+
* The fields to be fetched on query.
|
|
251
|
+
*
|
|
252
|
+
* E.g. ["id", "displayName", "description"]
|
|
253
|
+
*/
|
|
254
|
+
select?: string[];
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
userGroupMember?: {
|
|
258
|
+
/**
|
|
259
|
+
* The filter to apply to extract users by groups memberships.
|
|
260
|
+
*
|
|
261
|
+
* E.g. "displayName eq 'Backstage Users'"
|
|
262
|
+
*/
|
|
263
|
+
filter?: string;
|
|
264
|
+
/**
|
|
265
|
+
* The search criteria to apply to extract groups.
|
|
266
|
+
*
|
|
267
|
+
* E.g. "\"displayName:-team\"" would only match groups which contain '-team'
|
|
268
|
+
*/
|
|
269
|
+
search?: string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
>;
|
|
273
|
+
};
|
|
105
274
|
};
|
|
106
275
|
}
|