{"id":15013804,"url":"https://github.com/oktadev/native-java-examples","last_synced_at":"2025-04-12T05:45:26.524Z","repository":{"id":37783113,"uuid":"376978236","full_name":"oktadev/native-java-examples","owner":"oktadev","description":"Native Java Apps with Micronaut, Quarkus, and Spring Boot","archived":false,"fork":false,"pushed_at":"2023-08-24T06:36:55.000Z","size":497,"stargazers_count":62,"open_issues_count":11,"forks_count":33,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-12T05:45:15.720Z","etag":null,"topics":["graalvm","helidon","java","micronaut","native","oauth2","oidc","quarkus","spring-boot"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2021/06/18/native-java-framework-comparison","language":"HTML","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/oktadev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-14T23:09:38.000Z","updated_at":"2025-02-22T12:27:28.000Z","dependencies_parsed_at":"2024-09-16T01:00:55.555Z","dependency_job_id":null,"html_url":"https://github.com/oktadev/native-java-examples","commit_stats":{"total_commits":92,"total_committers":3,"mean_commits":"30.666666666666668","dds":"0.021739130434782594","last_synced_commit":"2c9d53a25150a0a9febcbfd9e9edf08186c6ee02"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fnative-java-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fnative-java-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fnative-java-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fnative-java-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/native-java-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525154,"owners_count":21118616,"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":["graalvm","helidon","java","micronaut","native","oauth2","oidc","quarkus","spring-boot"],"created_at":"2024-09-24T19:44:48.111Z","updated_at":"2025-04-12T05:45:26.447Z","avatar_url":"https://github.com/oktadev.png","language":"HTML","readme":"# Native Java Examples: Micronaut, Quarkus, Spring Boot, and Helidon\n\nThis repository contains example OAuth 2.0 resource servers built with Micronaut, Quarkus, and Spring Boot. If you'd like to see how they were built, please read [Build Native Java Apps with Micronaut, Quarkus, and Spring Boot][blog].\n\nThis project also contains a Helidon example. You can read about how it was built and how it compares in [Build REST APIs and Native Java Apps with Helidon][blog-helidon].\n\n**Prerequisites:** [Java 17 with GraalVM](https://sdkman.io/), [HTTPie](https://httpie.io/), and [Docker](https://docs.docker.com/engine/install/) (optional).\n\n* [Getting Started](#getting-started)\n* [Links](#links)\n* [Help](#help)\n* [License](#license)\n\n## Getting Started\n\nFirst, clone this repository:\n\n```bash\ngit clone https://github.com/oktadev/native-java-examples.git\n```\n\nYou will need a JDK with GraalVM and its native-image compiler. Using [SDKMAN](https://sdkman.io), run the following command and set it as the default:\n\n```bash\nsdk install java 22.3.r17-grl\n```\n\nNext, you'll need a free Okta developer account. Install the [Okta CLI](https://cli.okta.com/) and run `okta register` to sign up for a new account. If you already have an account, run `okta login`. Then, run `okta apps create`. Select the default app name, or change it as you see fit. Choose **Single-Page App** and press **Enter**.\n\nUse `https://oidcdebugger.com/debug` for the Redirect URI and accept the default Logout Redirect URI of `https://oidcdebugger.com/`.\n\nTake note of the `clientId` and `issuer` values. You'll need those to get an access token and to configure each framework for JWT authentication.\n\nChange the following files for each framework to match your Okta domain:\n\n- Micronaut: `micronaut/src/main/resources/application.yml`\n- Quarkus: `quarkus/src/main/resources/application.properties`\n- Spring Boot: `spring-boot/src/main/resources/application.properties`\n- Helidon: `helidon/src/main/resources/META-INF/microprofile-config.properties`\n\nYou can start each app using Maven. Note that you will only be able to start one at a time since they all run on port 8080.\n\n- Micronaut: `./mvnw mn:run`\n- Quarkus: `./mvnw quarkus:dev`\n- Spring Boot: `./mvnw spring-boot:run`\n- Helidon: `mvn package \u0026\u0026 java -jar target/helidon.jar`\n\nThen, you can test them with an access token and HTTPie.\n\nYou can generate an access token using [OpenID Connect Debugger](https://oidcdebugger.com/). First, you must configure your application on Okta to use OpenID Connect's implicit flow.\n\nRun `okta login` and open the resulting URL in your browser. Go to the **Applications** section and select the application you created with the CLI. Edit its General Settings and add **Implicit (Hybrid)** as an allowed grant type, with access token enabled. Click **Save** and copy the client ID for the next step.\n\nNow, navigate to the [OpenID Connect Debugger website](https://oidcdebugger.com/). Fill in your client ID, and use `https://{yourOktaDomain}/oauth2/default/v1/authorize` for the Authorize URI. The state field must be filled but can contain any characters. Select **token** for the response type. Click **Send Request** to continue.\n\nOnce you have an access token, set it as a `TOKEN` environment variable in a terminal window.\n\n```bash\nTOKEN=eyJraWQiOiJYa2pXdjMzTDRBYU1ZSzNGM...\n```\n\nUse HTTPie to pass the JWT in as a bearer token in the `Authorization` header.\n\n```bash\nhttp :8080/hello Authorization:\"Bearer $TOKEN\"\n```\n\nYou should see your email address printed to your terminal.\n\nYou can also build and run each example as a native app.\n\n- Micronaut: `./mvnw package -Dpackaging=native-image`\n- Quarkus: `./mvnw package -Pnative`\n- Spring Boot: `./mvnw package -Pnative` (if you'd rather use Docker: `./mvnw spring-boot:build-image`)\n- Helidon: `mvn package -Pnative-image`\n\nThen, start each app as a native executable.\n\n- Micronaut: `./target/app`\n- Quarkus: `./target/quarkus-1.0.0-SNAPSHOT-runner`\n- Spring Boot:  `./target/demo` (if Docker: `docker run -p 8080:8080 demo:0.0.1-SNAPSHOT`)\n- Helidon: `./target/helidon`\n\nPlease read [Build Native Java Apps with Micronaut, Quarkus, and Spring Boot][blog] for performance numbers and analysis. To see how Helidon compares, see [Build REST APIs and Native Java Apps with Helidon][blog-helidon].\n\n## Links\n\nThis example uses the following open source libraries:\n\n* [Micronaut](https://micronaut.io)\n* [Quarkus](https://quarkus.io)\n* [Spring Boot](https://spring.io/projects/spring-boot)\n* [Helidon](https://helidon.io)\n\n## Help\n\nPlease post any questions as comments on [this example's blog post][blog], or on the [Okta Developer Forums](https://devforum.okta.com/).\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n\n[blog]: https://developer.okta.com/blog/2021/06/18/native-java-framework-comparison\n[blog-helidon]: https://developer.okta.com/blog/2022/01/06/native-java-helidon\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fnative-java-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fnative-java-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fnative-java-examples/lists"}