From 58b1486c813b9f89e2993b5850c937e9f71b6c0c Mon Sep 17 00:00:00 2001 From: Joxit Date: Thu, 8 Apr 2021 18:11:08 +0200 Subject: [PATCH] feat(token-auth-keycloak): add token auth via keycloak using docker protocol --- .../token-auth-keycloak/docker-compose.yml | 5 +- src/components/catalog/catalog.riot | 4 +- .../dialogs/registry-authentication.riot | 71 +++++++++++++++++++ src/components/docker-registry-ui.riot | 35 ++++++++- src/components/tag-history/tag-history.riot | 11 ++- src/components/tag-list/tag-list.riot | 10 ++- src/scripts/docker-image.js | 33 +++++---- src/scripts/http.js | 55 +++++++++----- 8 files changed, 180 insertions(+), 44 deletions(-) create mode 100644 src/components/dialogs/registry-authentication.riot diff --git a/examples/token-auth-keycloak/docker-compose.yml b/examples/token-auth-keycloak/docker-compose.yml index 95abf9c..50bb185 100644 --- a/examples/token-auth-keycloak/docker-compose.yml +++ b/examples/token-auth-keycloak/docker-compose.yml @@ -22,10 +22,11 @@ services: - registry-ui-net ui: - image: joxit/docker-registry-ui:static + image: joxit/docker-registry-ui environment: REGISTRY_TITLE: My Private Docker Registry - URL: http://localhost + REGISTRY_URL: http://localhost + SINGLE_REGISTRY: 'true' networks: - registry-ui-net diff --git a/src/components/catalog/catalog.riot b/src/components/catalog/catalog.riot index f8def0f..6fa8d66 100644 --- a/src/components/catalog/catalog.riot +++ b/src/components/catalog/catalog.riot @@ -55,7 +55,9 @@ along with this program. If not, see . display(props, state) { let repositories = []; const self = this; - const oReq = new Http(); + const oReq = new Http({ + onAuthentication: this.props.onAuthentication + }); oReq.addEventListener('load', function () { if (this.status == 200) { repositories = JSON.parse(this.responseText).repositories || []; diff --git a/src/components/dialogs/registry-authentication.riot b/src/components/dialogs/registry-authentication.riot new file mode 100644 index 0000000..2a33645 --- /dev/null +++ b/src/components/dialogs/registry-authentication.riot @@ -0,0 +1,71 @@ + + + +
Sign In to your registry
+
+ + +
+
+ + Sign In + + + Cancel + +
+
+ +
\ No newline at end of file diff --git a/src/components/docker-registry-ui.riot b/src/components/docker-registry-ui.riot index 3a03ce1..3336716 100644 --- a/src/components/docker-registry-ui.riot +++ b/src/components/docker-registry-ui.riot @@ -28,20 +28,23 @@ along with this program. If not, see . + filter-results="{ state.filter }" on-authentication="{ onAuthentication }" /> + filter-results="{ state.filter }" on-authentication="{ onAuthentication }"> + is-image-remove-activated="{ props.isImageRemoveActivated }" on-notify="{ notifySnackbar }" on-authentication="{ onAuthentication }"> +