@backstage-community/plugin-catalog-backend-module-keycloak 3.2.1 → 3.2.3
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
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
### Dependencies
|
|
2
2
|
|
|
3
|
+
## 3.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 74902d9: Clean up api report warnings and remove unnecessary files
|
|
8
|
+
|
|
9
|
+
## 3.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 3c72e65: Update Keycloak metadata to reflect dual maintenance support
|
|
14
|
+
- d3d078b: Updated dependency `@types/lodash` to `4.17.13`.
|
|
15
|
+
|
|
3
16
|
## 3.2.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -6,40 +6,51 @@ import { GroupEntity, UserEntity } from '@backstage/catalog-model';
|
|
|
6
6
|
import GroupRepresentation from '@keycloak/keycloak-admin-client/lib/defs/groupRepresentation';
|
|
7
7
|
import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
interface GroupRepresentationWithParent extends GroupRepresentation {
|
|
10
13
|
parentId?: string;
|
|
11
14
|
parent?: string;
|
|
12
15
|
members?: string[];
|
|
13
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
14
20
|
interface GroupRepresentationWithParentAndEntity extends GroupRepresentationWithParent {
|
|
15
21
|
entity: GroupEntity;
|
|
16
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
17
26
|
interface UserRepresentationWithEntity extends UserRepresentation {
|
|
18
27
|
entity: UserEntity;
|
|
19
28
|
}
|
|
20
29
|
/**
|
|
21
|
-
* Customize the ingested User entity
|
|
30
|
+
* Customize the ingested User entity.
|
|
22
31
|
*
|
|
23
32
|
* @public
|
|
24
33
|
*
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
34
|
+
* @param entity - The output of the default parser.
|
|
35
|
+
* @param user - The Keycloak user representation.
|
|
36
|
+
* @param realm - The realm name.
|
|
37
|
+
* @param groups - Data about available groups, which can be used to create additional relationships.
|
|
29
38
|
*
|
|
30
|
-
* @returns
|
|
39
|
+
* @returns A promise resolving to a modified `UserEntity` object to be ingested into the catalog,
|
|
40
|
+
* or `undefined` to reject the entity.
|
|
31
41
|
*/
|
|
32
42
|
type UserTransformer = (entity: UserEntity, user: UserRepresentation, realm: string, groups: GroupRepresentationWithParentAndEntity[]) => Promise<UserEntity | undefined>;
|
|
33
43
|
/**
|
|
34
|
-
* Customize the ingested Group entity
|
|
44
|
+
* Customize the ingested Group entity.
|
|
35
45
|
*
|
|
36
46
|
* @public
|
|
37
47
|
*
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
48
|
+
* @param entity - The output of the default parser.
|
|
49
|
+
* @param group - The Keycloak group representation.
|
|
50
|
+
* @param realm - The realm name.
|
|
41
51
|
*
|
|
42
|
-
* @returns
|
|
52
|
+
* @returns A promise resolving to a modified `GroupEntity` object to be ingested into the catalog,
|
|
53
|
+
* or `undefined` to reject the entity.
|
|
43
54
|
*/
|
|
44
55
|
type GroupTransformer = (entity: GroupEntity, group: GroupRepresentation, realm: string) => Promise<GroupEntity | undefined>;
|
|
45
56
|
|
|
@@ -186,9 +197,16 @@ declare class KeycloakOrgEntityProvider implements EntityProvider {
|
|
|
186
197
|
schedule(taskRunner: SchedulerServiceTaskRunner): void;
|
|
187
198
|
}
|
|
188
199
|
|
|
200
|
+
/**
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
189
203
|
declare const noopGroupTransformer: GroupTransformer;
|
|
204
|
+
/**
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
190
207
|
declare const noopUserTransformer: UserTransformer;
|
|
191
208
|
/**
|
|
209
|
+
* @public
|
|
192
210
|
* User transformer that sanitizes .metadata.name from email address to a valid name
|
|
193
211
|
*/
|
|
194
212
|
declare const sanitizeEmailTransformer: UserTransformer;
|
|
@@ -212,8 +230,8 @@ type KeycloakTransformerExtensionPoint = {
|
|
|
212
230
|
/**
|
|
213
231
|
* Registers the `KeycloakEntityProvider` with the catalog processing extension point.
|
|
214
232
|
*
|
|
215
|
-
* @
|
|
233
|
+
* @public
|
|
216
234
|
*/
|
|
217
235
|
declare const catalogModuleKeycloakEntityProvider: _backstage_backend_plugin_api.BackendFeature;
|
|
218
236
|
|
|
219
|
-
export { type GroupRepresentationWithParent, type GroupRepresentationWithParentAndEntity, type GroupTransformer, KeycloakOrgEntityProvider, type KeycloakOrgEntityProviderOptions, type KeycloakTransformerExtensionPoint, type UserRepresentationWithEntity, type UserTransformer, catalogModuleKeycloakEntityProvider as default, keycloakTransformerExtensionPoint, noopGroupTransformer, noopUserTransformer, sanitizeEmailTransformer };
|
|
237
|
+
export { type GroupRepresentationWithParent, type GroupRepresentationWithParentAndEntity, type GroupTransformer, KeycloakOrgEntityProvider, type KeycloakOrgEntityProviderOptions, type KeycloakProviderConfig, type KeycloakTransformerExtensionPoint, type UserRepresentationWithEntity, type UserTransformer, catalogModuleKeycloakEntityProvider as default, keycloakTransformerExtensionPoint, noopGroupTransformer, noopUserTransformer, sanitizeEmailTransformer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformers.cjs.js","sources":["../../src/lib/transformers.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { GroupTransformer, UserTransformer } from './types';\n\nexport const noopGroupTransformer: GroupTransformer = async (\n entity,\n _user,\n _realm,\n) => entity;\n\nexport const noopUserTransformer: UserTransformer = async (\n entity,\n _user,\n _realm,\n _groups,\n) => entity;\n\n/**\n * User transformer that sanitizes .metadata.name from email address to a valid name\n */\nexport const sanitizeEmailTransformer: UserTransformer = async (\n entity,\n _user,\n _realm,\n _groups,\n) => {\n entity.metadata.name = entity.metadata.name.replace(/[^a-zA-Z0-9]/g, '-');\n return entity;\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"transformers.cjs.js","sources":["../../src/lib/transformers.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { GroupTransformer, UserTransformer } from './types';\n\n/**\n * @public\n */\nexport const noopGroupTransformer: GroupTransformer = async (\n entity,\n _user,\n _realm,\n) => entity;\n\n/**\n * @public\n */\nexport const noopUserTransformer: UserTransformer = async (\n entity,\n _user,\n _realm,\n _groups,\n) => entity;\n\n/**\n * @public\n * User transformer that sanitizes .metadata.name from email address to a valid name\n */\nexport const sanitizeEmailTransformer: UserTransformer = async (\n entity,\n _user,\n _realm,\n _groups,\n) => {\n entity.metadata.name = entity.metadata.name.replace(/[^a-zA-Z0-9]/g, '-');\n return entity;\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,oBAAyC,GAAA,OACpD,MACA,EAAA,KAAA,EACA,MACG,KAAA,OAAA;AAKE,MAAM,mBAAuC,GAAA,OAClD,MACA,EAAA,KAAA,EACA,QACA,OACG,KAAA,OAAA;AAME,MAAM,wBAA4C,GAAA,OACvD,MACA,EAAA,KAAA,EACA,QACA,OACG,KAAA;AACH,EAAA,MAAA,CAAO,SAAS,IAAO,GAAA,MAAA,CAAO,SAAS,IAAK,CAAA,OAAA,CAAQ,iBAAiB,GAAG,CAAA,CAAA;AACxE,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogModuleKeycloakEntityProvider.cjs.js","sources":["../../src/module/catalogModuleKeycloakEntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { InputError } from '@backstage/errors';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\n\nimport { keycloakTransformerExtensionPoint } from '../extensions';\nimport type { GroupTransformer, UserTransformer } from '../lib/types';\nimport { KeycloakOrgEntityProvider } from '../providers';\n\n/**\n * Registers the `KeycloakEntityProvider` with the catalog processing extension point.\n *\n * @
|
|
1
|
+
{"version":3,"file":"catalogModuleKeycloakEntityProvider.cjs.js","sources":["../../src/module/catalogModuleKeycloakEntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { InputError } from '@backstage/errors';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\n\nimport { keycloakTransformerExtensionPoint } from '../extensions';\nimport type { GroupTransformer, UserTransformer } from '../lib/types';\nimport { KeycloakOrgEntityProvider } from '../providers';\n\n/**\n * Registers the `KeycloakEntityProvider` with the catalog processing extension point.\n *\n * @public\n */\nexport const catalogModuleKeycloakEntityProvider = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'catalog-backend-module-keycloak',\n register(env) {\n let userTransformer: UserTransformer | undefined;\n let groupTransformer: GroupTransformer | undefined;\n\n env.registerExtensionPoint(keycloakTransformerExtensionPoint, {\n setUserTransformer(transformer) {\n if (userTransformer) {\n throw new InputError('User transformer may only be set once');\n }\n userTransformer = transformer;\n },\n setGroupTransformer(transformer) {\n if (groupTransformer) {\n throw new InputError('Group transformer may only be set once');\n }\n groupTransformer = transformer;\n },\n });\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n config: coreServices.rootConfig,\n logger: coreServices.logger,\n scheduler: coreServices.scheduler,\n },\n async init({ catalog, config, logger, scheduler }) {\n catalog.addEntityProvider(\n KeycloakOrgEntityProvider.fromConfig(\n { config, logger },\n {\n scheduler: scheduler,\n schedule: scheduler.createScheduledTaskRunner({\n frequency: { minutes: 30 },\n timeout: { minutes: 3 },\n }),\n userTransformer: userTransformer,\n groupTransformer: groupTransformer,\n },\n ),\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","keycloakTransformerExtensionPoint","InputError","catalogProcessingExtensionPoint","coreServices","KeycloakOrgEntityProvider"],"mappings":";;;;;;;;AAgCO,MAAM,sCAAs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BAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-catalog-backend-module-keycloak",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "A Backend backend plugin for Keycloak",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@backstage/config": "1.2.0",
|
|
57
57
|
"@backstage/plugin-catalog-backend": "1.27.1",
|
|
58
58
|
"@spotify/prettier-config": "^15.0.0",
|
|
59
|
-
"@types/lodash": "4.17.
|
|
59
|
+
"@types/lodash": "4.17.13",
|
|
60
60
|
"@types/uuid": "9.0.8",
|
|
61
61
|
"deepmerge": "4.3.1",
|
|
62
62
|
"prettier": "3.3.3"
|
|
@@ -78,6 +78,8 @@
|
|
|
78
78
|
"lifecycle:active",
|
|
79
79
|
"backstage",
|
|
80
80
|
"plugin",
|
|
81
|
+
"works-with:rhsso:^7.6",
|
|
82
|
+
"works-with:keycloak:~18",
|
|
81
83
|
"works-with:rhbk:^24",
|
|
82
84
|
"works-with:keycloak:~24"
|
|
83
85
|
],
|