Skip to content

Commit

Permalink
Merge pull request #333 from UKHomeOffice/acpeng-2152-2
Browse files Browse the repository at this point in the history
ACPENG-2152 - user deactivation issue
  • Loading branch information
ukho-cfreeman authored Dec 12, 2024
2 parents 2bb5198 + d4e8bd4 commit ff29dc1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ steps:
- name: web_tests_then_build_dist
image: quay.io/ukhomeofficedigital/nodejs-base:v6.9.1
commands:
## Band aid workaround to build container after centos7 EOL 20240701 - https://serverfault.com/questions/1161816/mirrorlist-centos-org-no-longer-resolve
- sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
- sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
- sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- yum install -y git bzip2 bzip2-libs fontconfig
- git config --global url."https://".insteadOf git://
- npm install -g [email protected]
Expand Down Expand Up @@ -55,6 +59,8 @@ steps:
environment:
IMAGE_NAME: platform-hub-web:${DRONE_COMMIT_SHA}
IGNORE_UNFIXED: "true"
FAIL_ON_DETECTION: false
FAIL_ON_EOL_OS_DETECTION: false
when:
event:
- pull_request
Expand Down Expand Up @@ -156,6 +162,8 @@ steps:
environment:
IMAGE_NAME: platform-hub-api:${DRONE_COMMIT_SHA}
IGNORE_UNFIXED: "true"
FAIL_ON_DETECTION: false
FAIL_ON_EOL_OS_DETECTION: false
when:
event:
- pull_request
Expand Down
1 change: 1 addition & 0 deletions platform-hub-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apk update && apk upgrade \
&& apk --update add --virtual build_deps sudo build-base ruby-dev libc-dev libressl-dev zlib-dev \
&& echo 'gem: --no-document' > /etc/gemrc \
&& gem install bundler -v 2.1.4 \
&& gem install "rubygems-update:<3.0.0" --no-document \
&& gem update --system \
&& rm /etc/ssl/certs/ca-cert-DST_ACES_CA_X6.pem \
&& rm /etc/ssl/certs/ca-cert-DST_Root_CA_X3.pem \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def bearer_token
end

begin
response = client.post "/auth/realms/#{@realm}/protocol/openid-connect/token",
response = client.post "/realms/#{@realm}/protocol/openid-connect/token",
{
client_id: @client_id,
client_secret: @client_secret,
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_user_representation(user)
raise Errors::KeycloakIdentityMissing if user_id.nil?

begin
response = client.get "/auth/admin/realms/#{@realm}/users/#{user_id}",
response = client.get "/admin/realms/#{@realm}/users/#{user_id}",
{},
{Authorization: "Bearer #{bearer_token}"}
rescue => e
Expand All @@ -108,7 +108,7 @@ def update_user(representation = {})
end

begin
response = client.put "/auth/admin/realms/#{@realm}/users/#{user_id}",
response = client.put "/admin/realms/#{@realm}/users/#{user_id}",
representation.to_json,
{
'Authorization': "Bearer #{bearer_token}",
Expand Down
2 changes: 1 addition & 1 deletion platform-hub-api/db/structure.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-
--
-- PostgreSQL database dump
--

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
expect(subject).to receive(:client) { client }

expect(client).to receive(:post).with(
"/auth/realms/#{realm}/protocol/openid-connect/token",
"/realms/#{realm}/protocol/openid-connect/token",
{
client_id: client_id,
client_secret: client_secret,
Expand Down Expand Up @@ -180,7 +180,7 @@
expect(subject).to receive(:client) { client }
expect(subject).to receive(:bearer_token) { bearer_token }
expect(client).to receive(:get).with(
"/auth/admin/realms/#{realm}/users/#{keycloak_user_id}",
"/admin/realms/#{realm}/users/#{keycloak_user_id}",
{},
{
'Authorization': "Bearer #{bearer_token}"
Expand Down Expand Up @@ -237,7 +237,7 @@
expect(subject).to receive(:client) { client }
expect(subject).to receive(:bearer_token) { bearer_token }
expect(client).to receive(:put).with(
"/auth/admin/realms/#{realm}/users/#{keycloak_user_id}",
"/admin/realms/#{realm}/users/#{keycloak_user_id}",
representation.to_json,
{
'Authorization': "Bearer #{bearer_token}",
Expand Down

0 comments on commit ff29dc1

Please sign in to comment.