{"id":31626598,"url":"https://github.com/giljr/keycloak-omniauth","last_synced_at":"2025-10-06T19:54:05.075Z","repository":{"id":309975146,"uuid":"1037686773","full_name":"giljr/keycloak-omniauth","owner":"giljr","description":"Configure OmniAuth for Keycloak in a Rails app.","archived":false,"fork":false,"pushed_at":"2025-08-23T22:34:25.000Z","size":652,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T05:59:07.814Z","etag":null,"topics":["authentication","authorization-code-grant","docker","keycloak","middleware","oidc","oidc-client","oidc-provider","omniauth","working-apps"],"latest_commit_sha":null,"homepage":"https://medium.com/jungletronics/omniauth-with-keycloak-in-rails-8-e777161a2c2b","language":"FreeMarker","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giljr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-14T01:02:42.000Z","updated_at":"2025-08-23T22:31:41.000Z","dependencies_parsed_at":"2025-08-16T11:15:20.013Z","dependency_job_id":null,"html_url":"https://github.com/giljr/keycloak-omniauth","commit_stats":null,"previous_names":["giljr/keycloak-omniauth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/giljr/keycloak-omniauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giljr%2Fkeycloak-omniauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giljr%2Fkeycloak-omniauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giljr%2Fkeycloak-omniauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giljr%2Fkeycloak-omniauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giljr","download_url":"https://codeload.github.com/giljr/keycloak-omniauth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giljr%2Fkeycloak-omniauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278671741,"owners_count":26025744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","authorization-code-grant","docker","keycloak","middleware","oidc","oidc-client","oidc-provider","omniauth","working-apps"],"created_at":"2025-10-06T19:54:01.676Z","updated_at":"2025-10-06T19:54:05.070Z","avatar_url":"https://github.com/giljr.png","language":"FreeMarker","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keycloak Custom Theme with Maven in Rails 8\n\n## Prerequisites\n- Keycloak v26+ running\n- Basic Keycloak admin knowledge\n- Familiarity with FreeMarker templates (FTL)\n- Maven 3.6.3+\n- Java 21+\n- Rails 8 project for integration testing\n- Visual Studio Code\n\n## Overview\nCustomize Keycloak login, account, and email screens to match your Rails app branding.\n\n---\n\n## Quickstart: Keycloak + MailHog (Docker)\n\n\n### 1. Clean Docker\n```bash\ndocker rm -f $(docker ps -a -q) \u0026\u0026 docker system prune -a\n```\n```bash\ndocker network create demo-network\n```\n### 2. Run Keycloak\n```bash\ndocker run -d --name keycloak --network demo-network -p 8080:8080 \\\n  -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \\\n  -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \\\n  quay.io/keycloak/keycloak:latest start-dev\n```\n### 3. Run MailHog\n```bash\ndocker run -d -p 8025:8025 --name demo-mail --network demo-network mailhog/mailhog\n```\n\n### 4. Open Keycloak admin: localhost:8080 (admin/admin)\n\n#### 4.1 Create realm quickstart and client test-cli\n\n### 5 Configure client as OpenID Connect with your Rails app URLs\n\n#### 5.1 Rails Credentials\n```bash\nEDITOR=\"code --wait\" rails credentials:edit\n```\n```code\nkeycloak:\n  client_id: your-client-id\n  client_secret: your-client-secret\n  host: http://localhost\n  port: 8080\n  realm: quickstart\n  redirect_uri: http://localhost:3000/auth/keycloak/callback\n\nsecret_key_base: \u003cgenerated\u003e\n```\n### 6. Build Keycloak Theme with Maven\n\n#### 6.1 Generate Maven project\n```maven\nmvn archetype:generate \\\n  -DgroupId=com.bootlabs \\\n  -DartifactId=keycloak-custom-theme \\\n  -DarchetypeArtifactId=maven-archetype-quickstart \\\n  -DinteractiveMode=false\n```\n#### 6.2  Remove default Java sources\n```bash\nrm -rf src/\nmkdir -p src/main/resources/theme/keycloak-custom-theme/login\n```\n### 7. Key Files\n\n    login/login.ftl → Login page template\n\n    login/resources/css/login.css → Styles\n\n    login/resources/img/logo.png → Logo\n\n    theme.properties → Theme metadata\n\n    scripts/update-footer.sh → Footer script with Git commit/version\n\n### 8. Update Footer Script\n```bash\n#!/bin/bash\nset -e\nGIT_HASH=$(git rev-parse --short HEAD)\nDATE=$(date +\"%Y-%m-%d\")\nYEAR=$(date +\"%Y\")\nFOOTER_FILE=\"src/main/resources/theme/keycloak-custom-theme/login/footer.ftl\"\ncat \u003c\u003cEOF \u003e \"$FOOTER_FILE\"\n\u003c#macro content\u003e\n\u003cfooter id=\"kc-footer\" style=\"display:flex;flex-direction:column;align-items:center;text-align:center;padding:1rem;font-size:0.85rem;color:#666;\"\u003e\n\u003cp\u003e\u0026copy; $YEAR Company inc — All right reserved.\u003c/p\u003e\n\u003cp\u003eVersion $GIT_HASH ($DATE)\u003c/p\u003e\n\u003cp\u003eSupport: \u003ca href=\"mailto:support@org.inc\"\u003esupport@org.inc\u003c/a\u003e\u003c/p\u003e\n\u003c/footer\u003e\n\u003c/#macro\u003e\nEOF\necho \"✅ Footer updated successfully in $FOOTER_FILE\"\n```\n### 9. Build \u0026 Deploy Theme\n```bash\nmvn clean install\n```\nThis runs update-footer.sh and packages the theme as a JAR\n\nTheme is deployed to Keycloak Docker container via Maven exec plugin\n\n### 10. Activate Theme\n\nGo to `Keycloak \u003e Realm quickstart \u003e Client test-cli \u003e Realm settings \u003e Themes`\n\nSet `Login Theme` to `keycloak-custom-theme` and **save**\n\n### 10. Test\n\nRun Rails app:\n```bash\nbin/dev\n```\nVisit `localhost:3000` and click `Login with Keycloak`\n\n### 11. Check email via localhost:8025 (MailHog)\n\n\n### 12. References\n\n[Tutorial: OmniAuth with Keycloak in Rails 8]()\n\n## Acknowledgements\n\n - [Omniauth::Keycloak](https://github.com/ccrockett/omniauth-keycloak)\n - [Jeovan Farias](https://www.linkedin.com/in/jeovan-f-6283b8145/)\n - [Keycloak For beginers](https://medium.com/jungletronics/keycloak-identity-provider-192ffd9a00ae)\n\n\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiljr%2Fkeycloak-omniauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiljr%2Fkeycloak-omniauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiljr%2Fkeycloak-omniauth/lists"}