Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 95a1441

Browse files
author
Akanksh Saxena
authored
Merge pull request #460 from hairmare/feat/12-factor-injectable-sso-config-for-timed
feat(oidc): runtime configurable oidc endpoint and client id
2 parents 9ee9ac3 + 7479ea0 commit 95a1441

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ COPY ./contrib/nginx.conf /etc/nginx/conf.d/default.conf
1515

1616
WORKDIR /var/www/html
1717

18+
COPY ./docker-entrypoint.sh /
19+
ENV TIMED_SSO_CLIENT_HOST https://sso.example.com/auth/realms/example/protocol/openid-connect
20+
ENV TIMED_SSO_CLIENT_ID timed
21+
1822
EXPOSE 80
1923

20-
ENTRYPOINT []
24+
ENTRYPOINT ["/docker-entrypoint.sh"]
2125
CMD ["nginx", "-g", "daemon off;"]

config/environment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ module.exports = function(environment) {
102102

103103
// eslint-disable-next-line no-empty
104104
if (environment === "production") {
105-
ENV["ember-simple-auth-oidc"].host =
106-
"https://sso.adfinis-sygroup.ch/auth/realms/adsy/protocol/openid-connect";
105+
ENV["ember-simple-auth-oidc"].host = "sso-client-host";
106+
ENV["ember-simple-auth-oidc"].clientId = "sso-client-id";
107107
}
108108

109109
return ENV;

docker-entrypoint.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env sh
2+
3+
set -eu
4+
5+
urlencode() {
6+
# urlencode <string>
7+
# blatantly pinched from https://gist.github.com/cdown/1163649
8+
9+
local length="${#1}"
10+
for i in $(seq 0 $((length-1))); do
11+
local c="${1:i:1}"
12+
case $c in
13+
[a-zA-Z0-9.~_-]) printf "$c" ;;
14+
*) printf '%%%02X' "'$c" ;;
15+
esac
16+
done
17+
}
18+
19+
sed -i \
20+
-e "s/sso-client-id/$(urlencode ${TIMED_SSO_CLIENT_ID})/g" \
21+
-e "s/sso-client-host/$(urlencode ${TIMED_SSO_CLIENT_HOST})/g" \
22+
/var/www/html/index.html
23+
24+
exec "$@"

0 commit comments

Comments
 (0)