{"id":20381526,"url":"https://github.com/snowdrop/secured-example","last_synced_at":"2026-01-11T17:42:35.327Z","repository":{"id":44633853,"uuid":"75102995","full_name":"snowdrop/secured-example","owner":"snowdrop","description":"Quickstart to expose a REST Greeting endpoint using Spring Boot \u0026 Secured by Red Hat SSO","archived":false,"fork":false,"pushed_at":"2022-10-19T13:15:52.000Z","size":18604,"stargazers_count":5,"open_issues_count":0,"forks_count":19,"subscribers_count":5,"default_branch":"sb-2.7.x","last_synced_at":"2025-06-12T01:06:55.753Z","etag":null,"topics":["booster","example","keycloak","kubernetes","openshift","rhoar","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snowdrop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-29T16:59:56.000Z","updated_at":"2022-11-28T04:38:49.000Z","dependencies_parsed_at":"2023-01-20T06:03:54.546Z","dependency_job_id":null,"html_url":"https://github.com/snowdrop/secured-example","commit_stats":null,"previous_names":["obsidian-toaster-quickstarts/quick_secured_rest-springboot"],"tags_count":233,"template":false,"template_full_name":null,"purl":"pkg:github/snowdrop/secured-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fsecured-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fsecured-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fsecured-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fsecured-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowdrop","download_url":"https://codeload.github.com/snowdrop/secured-example/tar.gz/refs/heads/sb-2.7.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowdrop%2Fsecured-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263215288,"owners_count":23431894,"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":["booster","example","keycloak","kubernetes","openshift","rhoar","spring-boot","sso"],"created_at":"2024-11-15T02:14:12.087Z","updated_at":"2026-01-11T17:42:35.296Z","avatar_url":"https://github.com/snowdrop.png","language":"Java","readme":"# Secured Spring Boot Example\n\nhttps://appdev.openshift.io/docs/spring-boot-runtime.html#mission-secured-spring-boot\n\n## Table of Contents\n\n* [Secured Spring Boot Example](#secured-spring-boot-example)\n    * [Prerequisites](#prerequisites)\n    * [How to play with the SSO Example locally](#how-to-play-with-the-sso-example-locally)\n    * [How to run the SSO Example on OpenShift](#how-to-run-the-sso-example-on-openshift)\n    * [Deploying application on OpenShift using Helm](#deploying-application-on-openshift-using-helm)\n    * [Running Tests on OpenShift using Dekorate](#running-tests-on-openshift-using-dekorate)\n    * [Running Tests on OpenShift using S2i from Source](#running-tests-on-openshift-using-s2i-from-source)\n    * [Running Tests on OpenShift using Helm](#running-tests-on-openshift-using-helm)\n\n## Prerequisites\n\n- JDK 11+ installed with JAVA_HOME configured appropriately\n\n## How to play with the SSO Example locally\n\n- Deploy Keycloak on Openshift\n```\noc new-project sso\noc create -f .openshiftio/sso.yaml\n```\n\n- Get Keycloak Auth Endpoint\n```\nSSO_URL=$(oc get route sso -o jsonpath='http://{.spec.host}/auth')\n```\n\n- Start the application. Provide the Keycloak URL in a `SSO_AUTH_SERVER_URL` parameter. \n```\nmvn spring-boot:run -DSSO_AUTH_SERVER_URL=${SSO_URL}\n```\n\n- Use curl to access the endpoint without authentication (you will receive an unauthorized error)\n```\ncurl -v http://localhost:8080/api/greeting\n```\n\n- Open the application webpage in your browser `http://localhost:8080` and log in with one of the user credentials.\n\n| Username | Password | Expected status code |\n| -------- | -------- | -------------------- |\n| alice    | password | 200                  |\n| admin    | admin    | 403                  |\n\nUser `alice` is recognised by the system and has permission to access the greeting service.\n`admin` on the other hand, is recognised by the system but cannot access the greeting service.\n\n- Try accessing the greeting service by using the form or the `curl` command displayed in the webpage.\n\n## How to run the SSO Example on OpenShift\n\n- Deploy Keycloak on Openshift.\n```\noc new-project sso\noc create -f .openshiftio/sso.yaml\n```\n\nObtain the `SSO_URL`\n\n```shell\nSSO_URL=$(oc get route sso -o jsonpath='http://{.spec.host}/auth')\n```\n\n- Build and deploy the Spring Boot application using Dekorate.\n```\nmvn clean verify -Popenshift -Ddekorate.deploy=true -DSSO_AUTH_SERVER_URL=${SSO_URL}\n```\n\n## Deploying application on OpenShift using Helm\n\nFirst, make sure you have installed [the Helm command line](https://helm.sh/docs/intro/install/) and connected/logged to a kubernetes cluster.\n\nNow, deploy Keycloak on Openshift.\n```\noc create -f .openshiftio/sso.yaml\n```\n\nAnd obtain the `SSO_URL`:\n\n```shell\nSSO_URL=$(oc get route sso -o jsonpath='http://{.spec.host}/auth')\n```\n\nThen, you need to install the example by doing:\n\n```\nhelm install secured ./helm --set spring-boot-example-app.s2i.source.repo=https://github.com/snowdrop/secured-example --set spring-boot-example-app.s2i.source.ref=\u003cbranch-to-use\u003e --set spring-boot-example-app.s2i.env[0].name=\"MAVEN_ARGS_APPEND\" --set spring-boot-example-app.s2i.env[0].value=\"-DSSO_AUTH_SERVER_URL=${SSO_URL}\"\n```\n\n**note**: Replace `\u003cbranch-to-use\u003e` with one branch from `https://github.com/snowdrop/secured-example/branches/all`.\n\nAnd to uninstall the chart, execute:\n\n```\nhelm uninstall secured\n```\n\n## Running Tests on OpenShift using Dekorate\n\n```\n./run_tests_with_dekorate_in_ocp.sh\n```\n\n## Running Tests on OpenShift using S2i from Source\n\n```\n./run_tests_with_s2i.sh\n```\n\nThis script can take 2 parameters referring to the repository and the branch to use to source the images from.\n\n```bash\n./run_tests_with_s2i.sh \"https://github.com/snowdrop/secured-example\" branch-to-test\n```\n\n## Running Tests on OpenShift using Helm\n\n```\n./run_tests_with_helm.sh\n```\n\nThis script can take 2 parameters referring to the repository and the branch to use to source the images from.\n\n```bash\n./run_tests_with_helm.sh \"https://github.com/snowdrop/secured-example\" branch-to-test\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowdrop%2Fsecured-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowdrop%2Fsecured-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowdrop%2Fsecured-example/lists"}