Skip to content

Commit

Permalink
feat(oidc): make OIDC endpoint runtime configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
trowik committed Dec 5, 2023
1 parent b11dcd5 commit 2531d6b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/release-container-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ on:
required: true
TIMED_PROD_HOST:
required: true
OIDC_HOST:
required: true


jobs:
Expand Down Expand Up @@ -89,7 +87,6 @@ jobs:
AUTH_ROLE_CUSTOMER=${{ secrets.AUTH_ROLE_CUSTOMER }}
TIMED_STAGING_HOST=${{ secrets.TIMED_STAGING_HOST }}
TIMED_PROD_HOST=${{ secrets.TIMED_PROD_HOST }}
OIDC_HOST=${{ secrets.OIDC_HOST }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
labels: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,5 @@ jobs:
AUTH_ROLE_CUSTOMER: ${{ secrets.AUTH_ROLE_CUSTOMER }}
TIMED_STAGING_HOST: ${{ secrets.TIMED_STAGING_HOST }}
TIMED_PROD_HOST: ${{ secrets.TIMED_PROD_HOST }}
OIDC_HOST: ${{ secrets.OIDC_HOST }}


2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ARG AUTH_ROLE_EMPLOYEE
ARG AUTH_ROLE_CUSTOMER
ARG TIMED_STAGING_HOST
ARG TIMED_PROD_HOST
ARG OIDC_HOST
# Install dependencies.
RUN apk update && \
apk add --no-cache \
Expand Down Expand Up @@ -38,6 +37,7 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
WORKDIR /usr/share/nginx/html

COPY ./docker-entrypoint.sh /
ENV OIDC_CLIENT_HOST https://sso.example.com/auth/realms/example/protocol/openid-connect
ENV OIDC_CLIENT cc

EXPOSE 80
Expand Down
5 changes: 1 addition & 4 deletions frontend/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ module.exports = function (environment) {

if (environment === "production") {
// Whether Stage or Prod, the OIDC host and client will stay the same
ENV["ember-simple-auth-oidc"].host = env(
"OIDC_HOST",
"http://timed.local/auth/realms/timed/protocol/openid-connect"
);
ENV["ember-simple-auth-oidc"].host = "sso-client-host";
ENV["ember-simple-auth-oidc"].clientId = "sso-client-id";
}

Expand Down
1 change: 1 addition & 0 deletions frontend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ urlencode() {

sed -i \
-e "s/sso-client-id/$(urlencode ${OIDC_CLIENT})/g" \
-e "s/sso-client-host/$(urlencode ${OIDC_CLIENT_HOST})/g" \
/usr/share/nginx/html/index.html

exec "$@"

0 comments on commit 2531d6b

Please sign in to comment.