Skip to content

Commit

Permalink
changes Confluence page hierarchy retrieval to a recursive approach
Browse files Browse the repository at this point in the history
  • Loading branch information
tjuerge committed Jul 29, 2024
1 parent 8c8d812 commit 79f565b
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 329 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Release](https://img.shields.io/github/release/vaulttec/keycloak-confluence-ldap-group-mapper.svg)](https://github.com/vaulttec/keycloak-confluence-ldap-group-mapper/releases/latest)![](https://img.shields.io/github/license/vaulttec/keycloak-confluence-ldap-group-mapper?label=License)
![](https://img.shields.io/badge/Keycloak-23.0-blue)

Custom [Keycloak](https://www.keycloak.org) LDAP Group Mapper which creates groups and group memberships retrieved from [Confluence](https://www.atlassian.com/software/confluence) pages (representing the group hierarchy) and page properties (providing a HTML table with a group member column) via [Confluence's REST API](config/mock/confluence-openapi.yaml).
Custom [Keycloak](https://www.keycloak.org) LDAP Group Mapper which creates groups and group memberships retrieved from [Confluence](https://www.atlassian.com/software/confluence) pages (representing the group hierarchy) and page properties (providing a HTML table with a group member column) via [Confluence's REST API](https://developer.atlassian.com/server/confluence/confluence-server-rest-api/‚).

## Credit
This project uses ideas or artifacts from other projects, e.g.
Expand Down
292 changes: 0 additions & 292 deletions config/mock/confluence-openapi.yaml

This file was deleted.

69 changes: 66 additions & 3 deletions config/mock/initializerJson.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
{
"specUrlOrPayload": "/config/confluence-openapi.yaml"
}
[
{
"httpRequest": {
"method": "GET",
"path": "/confluence/rest/api/content/{id}/child/{type}",
"pathParameters": {
"id": ["1234"],
"type": ["page"]
}
},
"httpResponse": {
"statusCode": 200,
"body": "{\"page\":{\"results\":[{\"id\":\"1\",\"title\":\"Page 1\",\"children\":{\"page\":{\"results\":[{\"id\":\"11\",\"title\":\"Page 1.1\",\"_links\":{\"tinyui\":\"/x/Pcz-B11\"}},{\"id\":\"12\",\"title\":\"Page 1.2\",\"_links\":{\"tinyui\":\"/x/Pcz-B12\"}}]}},\"_links\":{\"tinyui\":\"/x/Pcz-B1\"}},{\"id\":\"2\",\"title\":\"Page 2\",\"children\":{\"page\":{\"results\":[]}},\"_links\":{\"tinyui\":\"/x/Pcz-B2\"}}]}}",
"headers": {
"Content-Type": ["application/json"]
}
}
},
{
"httpRequest": {
"method": "GET",
"path": "/confluence/rest/api/content/{id}/child/{type}",
"pathParameters": {
"id": ["11"],
"type": ["page"]
}
},
"httpResponse": {
"statusCode": 200,
"body": "{\"page\":{\"results\":[{\"id\":\"111\",\"title\":\"Page 1.1.1\",\"children\":{\"page\":{\"results\":[]}},\"_links\":{\"tinyui\":\"/x/Pcz-B111\"}},{\"id\":\"112\",\"title\":\"Page 1.1.2\",\"children\":{\"page\":{\"results\":[]}},\"_links\":{\"tinyui\":\"/x/Pcz-B112\"}}]}}",
"headers": {
"Content-Type": ["application/json"]
}
}
},
{
"httpRequest": {
"method": "GET",
"path": "/confluence/rest/api/content/{id}/child/{type}",
"pathParameters": {
"id": ["12"],
"type": ["page"]
}
},
"httpResponse": {
"statusCode": 200,
"body": "{ \"page\": { \"results\": [] } }",
"headers": {
"Content-Type": ["application/json"]
}
}
},
{
"httpRequest": {
"method": "GET",
"path": "/confluence/rest/masterdetail/1.0/detailssummary/lines"
},
"httpResponse": {
"statusCode": 200,
"body": "{\"currentPage\":0,\"totalPages\":1,\"renderedHeadings\":[\"Team\"],\"detailLines\":[{\"id\":11,\"title\":\"Team 1\",\"details\":[\"<div class=\\\"content-wrapper\\\"><div class=\\\"table-wrap\\\"><table class=\\\"wrapped confluenceTable\\\" data-mce-resize=\\\"false\\\"><colgroup><col/><col/><col/><col/></colgroup><tbody><tr><th class=\\\"confluenceTh\\\">Name</th><th class=\\\"confluenceTh\\\">Position</th><th class=\\\"confluenceTh\\\">Function</th><th class=\\\"confluenceTh\\\">Location</th></tr><tr><td class=\\\"confluenceTd\\\">John Doo</td><td class=\\\"confluenceTd\\\">Manager</td><td class=\\\"confluenceTd\\\"><a href=\\\"/confluence/display/ORG/Product+Owner\\\">Product Owner</a></td><td class=\\\"confluenceTd\\\">Anywhere</td></tr><tr><td class=\\\"confluenceTd\\\"> Doo, Jim </td><td class=\\\"confluenceTd\\\">Associate</td><td class=\\\"confluenceTd\\\"><a href=\\\"/confluence/display/ORG/Developer\\\">Developer</a></td><td class=\\\"confluenceTd\\\">Nowhere</td></tr><tr><td class=\\\"confluenceTd\\\">Jane Doo</td><td class=\\\"confluenceTd\\\">Analyst</td><td class=\\\"confluenceTd\\\"><a href=\\\"/confluence/display/ORG/Developer\\\">Developer</a></td><td class=\\\"confluenceTd\\\">Here</td></tr></tbody></table></div></div>\"]},{\"id\":12,\"title\":\"Team 2\",\"details\":[\"<div class=\\\"content-wrapper\\\"><div class=\\\"table-wrap\\\"><table class=\\\"wrapped confluenceTable\\\" data-mce-resize=\\\"false\\\"><colgroup><col/><col/><col/><col/></colgroup><tbody><tr><th class=\\\"confluenceTh\\\">Name</th><th class=\\\"confluenceTh\\\">Position</th><th class=\\\"confluenceTh\\\">Function</th><th class=\\\"confluenceTh\\\">Location</th></tr><tr><td class=\\\"confluenceTd\\\">Jane Doo</td><td class=\\\"confluenceTd\\\">Manager</td><td class=\\\"confluenceTd\\\"><a href=\\\"/confluence/display/ORG/Product+Owner\\\">Product Owner</a></td><td class=\\\"confluenceTd\\\">Here</td></tr><tr><td class=\\\"confluenceTd\\\"> Doo, John </td><td class=\\\"confluenceTd\\\">Associate</td><td class=\\\"confluenceTd\\\"><a href=\\\"/confluence/display/ORG/Developer\\\">Developer</a></td><td class=\\\"confluenceTd\\\">Nowhere</td></tr><tr><td class=\\\"confluenceTd\\\">Jim Doo</td><td class=\\\"confluenceTd\\\">Analyst</td><td class=\\\"confluenceTd\\\"><a href=\\\"/confluence/display/ORG/Developer\\\">Developer</a></td><td class=\\\"confluenceTd\\\">Anywhere</td></tr></tbody></table></div></div>\"]}]}",
"headers": {
"Content-Type": ["application/json"]
}
}
}
]
2 changes: 1 addition & 1 deletion config/realms/acme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ components:
config:
confluenceContent.baseUrl: ["$(env:CONFLUENCE_URL:-confluence-url)"]
confluenceContent.authToken: ["token"]
confluenceContent.parentPageId: [ "123"]
confluenceContent.parentPageId: [ "1234"]
confluenceContent.pageNesting: ["4"]
confluenceContent.spaceKey: ["TEST"]
confluenceContent.pageLabels: ["label1, label2, label3"]
Expand Down
Loading

0 comments on commit 79f565b

Please sign in to comment.