{"id":19433428,"url":"https://github.com/foo4u/keycloak-spring-demo","last_synced_at":"2025-04-24T20:31:33.913Z","repository":{"id":31189341,"uuid":"34749964","full_name":"foo4u/keycloak-spring-demo","owner":"foo4u","description":"Examples demonstrating how to use the Keycloak Spring Security adapter","archived":false,"fork":false,"pushed_at":"2015-06-09T15:43:59.000Z","size":208,"stargazers_count":57,"open_issues_count":1,"forks_count":31,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-03T10:02:42.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/foo4u.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}},"created_at":"2015-04-28T19:02:04.000Z","updated_at":"2024-05-22T21:36:16.000Z","dependencies_parsed_at":"2022-09-17T08:01:33.432Z","dependency_job_id":null,"html_url":"https://github.com/foo4u/keycloak-spring-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fkeycloak-spring-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fkeycloak-spring-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fkeycloak-spring-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo4u%2Fkeycloak-spring-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo4u","download_url":"https://codeload.github.com/foo4u/keycloak-spring-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250704652,"owners_count":21473735,"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","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":[],"created_at":"2024-11-10T14:39:47.307Z","updated_at":"2025-04-24T20:31:33.557Z","avatar_url":"https://github.com/foo4u.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keycloak Spring Security Examples\r\n\r\nDemonstrates how to use the Keycloak Spring Security adapter, including:\r\n\r\n* Login\r\n* Distributed SSO\r\n* Distributed Logout\r\n* OAuth2 Bearer Tokens\r\n\r\n## Requirements\r\n\r\nThe following examples are standalone Spring Boot applications.\r\n\r\nThey require the Keycloak appliance 1.2.0, running locally on port 8080 (the default for the\nstandalone appliance).\r\n\r\nThere are multiple Spring Boot projects.  These will all run on independently on the localhost\r\nlistening on differnt ports.\r\n\r\n* **customer-app** A Spring Boot application that does remote login using OAuth2 browser redirects with the auth server\r\n* **product-app** A Spring Boot application that does remote login using OAuth2 browser redirects with the auth server\r\n* **database-service** A Spring Boot RESTful application service authenticated by bearer tokens only. The customer and product app invoke it to get data.\r\n\r\n\r\n### Step 1: Make sure you've set up the Keycloak Server\r\n\r\nThe Keycloak Appliance Distribution comes with a preconfigured Keycloak server (based on Wildfly).  You must use it this server to run the Spring Security demos.  \r\n\r\n### Step 2: Boot Keycloak Server\r\n\r\nWhere you go to start up the Keycloak Server depends on which distro you installed.\r\n\r\nFrom appliance:\r\n\r\n```\r\n$ cd keycloak/bin\r\n$ ./standalone.sh\r\n```\r\n\r\n### Step 3: Import the Test Realm\r\n\r\nImport the test realm for the demo.  Clicking on the below link will bring you to the\r\ncreate realm page in the Admin UI.  The username/password is admin/admin to login in.  Keycloak will ask you to create a new admin password before you can go to the create \r\nrealm page.\r\n\r\nhttp://localhost:8080/auth/admin/master/console/#/create/realm\r\n\r\nImport the spring-demo-realm.json file that is in this project's root directory.\r\n\r\n\r\n### Step 4: Build and deploy\n\nLaunch each application (use a new terminal for each application):\n\r\n```\r\n$ ./gradlew database-service:bootRun\r\n$ ./gradlew customer-app:bootRun\r\n$ ./gradlew product-app:bootRun\r\n```\r\n\r\n### Step 5: Login and Observe Apps\r\n\r\nTry going to the customer app and view customer data:\r\n\r\nhttp://localhost:9092/customer-portal/\r\n\r\nThis should take you to the auth-server login screen.  Enter username: srossillo and password: password.\r\n\r\nIf you click on the products link, you'll be taken to the products app and show a product listing.  The redirects\r\nare still happening, but the auth-server knows you are already logged in so the login is bypassed.\r\n\r\nIf you click on the logout link of either of the product or customer app, you'll be logged out of all the applications.\r\n\r\n\r\n## Admin Console\r\n\r\nhttp://localhost:8080/auth/admin/index.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo4u%2Fkeycloak-spring-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo4u%2Fkeycloak-spring-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo4u%2Fkeycloak-spring-demo/lists"}