Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Add Keycloak theme #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/backend/
/frontend/
/just*.mjs/
/keycloak/themes/*
!/keycloak/themes/.gitkeep
/just*.mjs
/node_modules/
16 changes: 16 additions & 0 deletions just
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,21 @@ async function keybase_fs_read(path) {
return p.stdout;
}

async function install_keycloak_login_theme() {
if (await fs.exists('keycloak')) {
if (!(await fs.exists('keycloak/themes'))) {
await $`mkdir -p keycloak/themes`;
}
if (!(await fs.exists('keycloak/themes/EPFL'))) {
await $`git clone [email protected]:epfl-si/keycloak.theme-login-epfl.git keycloak/themes/EPFL`;
}
}
}

async function run() {
await gitCloneAll();
await $`cd keycloak && docker compose up -d`;
await install_keycloak_login_theme();
await $`cd frontend && yarn`;
await $`cd backend && yarn`;
const lhdTestDbPassword = YAML.parse(
Expand Down Expand Up @@ -104,6 +116,7 @@ ALLOWED_GROUPS=lhd_acces_lecture

async function runAuth() {
await gitCloneAll();
await install_keycloak_login_theme();
await $`cd keycloak && docker compose up -d`;
await $`npx --package concurrently@latest -y concurrently --kill-others-on-fail --names "keycloak" "cd keycloak && docker compose logs -f keycloak"`;
}
Expand Down Expand Up @@ -148,5 +161,8 @@ async function parseCmdLineDoThingsAndCleanup() {
} else if (argv._[0] === 'unclone') {
argv._.shift();
await unclone(...argv._);
} else if (argv._[0] === 'theme') {
argv._.shift();
await install_keycloak_login_theme();
}
}
1 change: 1 addition & 0 deletions keycloak/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- "127.0.0.1:8080:8080"
volumes:
- ./import:/opt/keycloak/data/import
- ./themes/EPFL:/opt/keycloak/themes/EPFL
# MariaDB is used by Keycloak for persistence. The Rails application
# itself uses sqlite in development (which unfortunately, is not an
# option for Keycloak at the moment).
Expand Down
1 change: 1 addition & 0 deletions keycloak/import/rails-realm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"realm" : "LHD",
"enabled" : true,
"loginTheme": "EPFL",
"groups" : [ {
"name" : "lhd_acces_lecture",
"path" : "/lhd_acces_lecture",
Expand Down
Empty file added keycloak/themes/.gitkeep
Empty file.