{"id":18479900,"url":"https://github.com/kolman-freecss/kf-imapi-auth-gateway","last_synced_at":"2026-04-20T10:32:17.761Z","repository":{"id":260170435,"uuid":"878730407","full_name":"Kolman-Freecss/kf-imapi-auth-gateway","owner":"Kolman-Freecss","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-24T09:59:32.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T18:56:40.929Z","etag":null,"topics":["docker","hexagonal-architecture","java","jwt","keycloak","microservice","oauth2","spring-boot","sso"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kolman-Freecss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-CC-BY-NC-ND","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":"2024-10-26T00:52:07.000Z","updated_at":"2025-01-24T09:59:37.000Z","dependencies_parsed_at":"2025-01-24T10:33:31.021Z","dependency_job_id":null,"html_url":"https://github.com/Kolman-Freecss/kf-imapi-auth-gateway","commit_stats":null,"previous_names":["kolman-freecss/kf-imapi-auth-gateway"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kolman-Freecss/kf-imapi-auth-gateway","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-imapi-auth-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-imapi-auth-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-imapi-auth-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-imapi-auth-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kolman-Freecss","download_url":"https://codeload.github.com/Kolman-Freecss/kf-imapi-auth-gateway/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-imapi-auth-gateway/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32043013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["docker","hexagonal-architecture","java","jwt","keycloak","microservice","oauth2","spring-boot","sso"],"created_at":"2024-11-06T12:16:28.194Z","updated_at":"2026-04-20T10:32:17.745Z","avatar_url":"https://github.com/Kolman-Freecss.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"- IMAPI Angular service: https://github.com/Kolman-Freecss/kf-imapi-angular\n- IMAPI Incident Service: https://github.com/Kolman-Freecss/kf-imapi-incident-service\n- IMAPI Response Team Service: https://github.com/Kolman-Freecss/kf-imapi-response-service\n- IMAPI Notification Service: https://github.com/Kolman-Freecss/kf-imapi-notification-service\n- IMAPI Authentication Gateway Service: https://github.com/Kolman-Freecss/kf-imapi-auth-gateway\n- IMAPI DevOps / Kafka Event Handling: https://github.com/Kolman-Freecss/kf-imapi-devops\n\n## Endpoint Utils\n\n- Prometheus: http://localhost:9090\n- Grafana: http://localhost:3000\n- Zipkin: http://localhost:9411\n- Keycloak: http://localhost:8080\n- Eureka: http://localhost:8761\n\n## Brief Description\n\nFeatures: \n- Implementation of security using Spring Boot 3.3 and Keycloak with JSON Web Tokens (JWT).\n- API Gateway for routing requests to the appropriate service.\n  - Circuit Breaker using Resilience4j.\n  - Also we hide the internal services from the outside world and KEYCLOAK (everything is behind the gateway).\n- SSO (Single Sign-On) using Keycloak.\n  - Each token is signed by Keycloak and validated by the API Gateway to access to all the services.\n- OAuth2 Protocol.\n- Internal JWT signing to validate the token in every microservice verifying the authenticity of the API Gateway token. (X-Internal-Auth)\n  - (Another robust option is to sign every token through TLS, but it is not implemented in this project).\n- Redis for caching. As request limiters.\n- Load Balancer using Eureka.\n- Testing\n  - Integration tests with Groovy and Spock. \n  - Performance tests with JMeter.\n  - Concurrent tests with Virtual Threads (JDK 19).\n\n## Getting Started\n\n- Configure Keycloak with the following settings:\n  - New Realm: `imapi`\n  - Create a new Client: `imapi-gateway`\n    - Client ID: `imapi-gateway`\n  - 2 Roles: `USER` and `ADMIN`\n  - 2 Users: `user` and `admin`\n    - Password: `password`\n    - Map Roles to the users: `USER` and `ADMIN`\n\n**Diagram Flow:**\n\n![Diagram Flow](Diagram-Flow.svg)\n\n## Tech stack:\n\n- Spring Boot 3.0\n- Keycloak\n- JSON Web Tokens (JWT)\n- Maven\n- Docker\n- Spring Cloud Gateway\n- Spring Cloud Netflix (Eureka)\n- Resilence4j (Circuit Breaker)\n- Observability - Micrometer Tracing and Zipkin (Distributed Tracing) (Sleuth is deprecated)\n  - We use AOP support to decorate the methods with tracing annotations.\n- Prometheus and Grafana (Monitoring)\n- Redis (Caching rate limiter)\n  - We can use Redis Insights (Client) to check the cache.\n\n## TroubleShooting\n\n- To wire all services through gateway ensure you add correctly the names and no duplicate services are up in same time.\n- We need to use a specific filters to modify the immutable request headers because not in every phase of the request lifecycle we can modify the headers.\n  - Also we need 2 filter, because not all traffic is going through the same spring path\n- Implementing the Cache with Redis at the Gateway level to limit the requests to the services.\n  - For some reason the cache with responses commited and stuff like that is not working properly.\n\n\n---\n\nShield: [![CC-BY-NC-ND 4.0][CC-BY-NC-ND-shield]][CC-BY-NC-ND]\n\nThis work is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.][CC-BY-NC-ND]\n\n[![CC-BY-NC-ND 4.0][CC-BY-NC-ND-image]][CC-BY-NC-ND]\n\n[CC-BY-NC-ND-shield]: https://img.shields.io/badge/License-CC--BY--NC--ND--4.0-lightgrey\n[CC-BY-NC-ND]: http://creativecommons.org/licenses/by-nc-nd/4.0/\n[CC-BY-NC-ND-image]: https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolman-freecss%2Fkf-imapi-auth-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkolman-freecss%2Fkf-imapi-auth-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolman-freecss%2Fkf-imapi-auth-gateway/lists"}