All Projects → oktadev → native-java-examples

oktadev / native-java-examples

Licence: Apache-2.0 license
Native Java Apps with Micronaut, Quarkus, and Spring Boot

Programming Languages

HTML
75241 projects
Batchfile
5799 projects
java
68154 projects - #9 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to native-java-examples

heterogeneous-microservices
Implementation of the same simple microservice on different frameworks
Stars: ✭ 43 (-2.27%)
Mutual labels:  micronaut, helidon, quarkus
Node Oidc Provider
OpenID Certified™ OAuth 2.0 Authorization Server implementation for Node.js
Stars: ✭ 2,018 (+4486.36%)
Mutual labels:  oauth2, oidc
Next Auth
Authentication for Next.js
Stars: ✭ 8,362 (+18904.55%)
Mutual labels:  oauth2, oidc
Authlib
The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.
Stars: ✭ 2,854 (+6386.36%)
Mutual labels:  oauth2, oidc
griffin-app-opensource
The Axway Griffin App goes open source!
Stars: ✭ 19 (-56.82%)
Mutual labels:  oauth2, native
brauzie
Awesome CLI for fetching JWT tokens for OAuth2.0 clients
Stars: ✭ 14 (-68.18%)
Mutual labels:  oauth2, oidc
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+5179.55%)
Mutual labels:  oauth2, oidc
Spring Native
Spring Native provides beta support for compiling Spring applications to native executables using GraalVM native-image compiler.
Stars: ✭ 2,282 (+5086.36%)
Mutual labels:  native, graalvm
opta-invest
Spring Boot/Quarkus/Micronaut + Optaplanner Portfolio Optimization
Stars: ✭ 21 (-52.27%)
Mutual labels:  micronaut, quarkus
IdentityServer4.PhoneNumberAuth
Sample passwordless phone number authentication using OAuth in ASP.NET Core 2.2
Stars: ✭ 83 (+88.64%)
Mutual labels:  oauth2, oidc
AzureADAuthRazorUiServiceApiCertificate
Azure AD flows using ASP.NET Core and Microsoft.Identity
Stars: ✭ 41 (-6.82%)
Mutual labels:  oauth2, oidc
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (+295.45%)
Mutual labels:  oauth2, oidc
mock-oauth2-server
A scriptable/customizable web server for testing HTTP clients using OAuth2/OpenID Connect or applications with a dependency to a running OAuth2 server (i.e. APIs requiring signed JWTs from a known issuer)
Stars: ✭ 83 (+88.64%)
Mutual labels:  oauth2, oidc
OpenAM
OpenAM is an open access management solution that includes Authentication, SSO, Authorization, Federation, Entitlements and Web Services Security.
Stars: ✭ 476 (+981.82%)
Mutual labels:  oauth2, oidc
okta-spring-security-5-example
Authentication with Spring Security 5 and Okta OIDC
Stars: ✭ 16 (-63.64%)
Mutual labels:  oauth2, oidc
Hydra
OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+26909.09%)
Mutual labels:  oauth2, oidc
quarkus-performance
Comparing the CPU/Memory utilisation - Quarkus via GraalVM Native Image vs. Quarkus via Java Runtime vs. Payara-Micro via Java Runtime.
Stars: ✭ 49 (+11.36%)
Mutual labels:  graalvm, quarkus
netty-native-demo
Instant Netty startup using GraalVM's Native Image Generation
Stars: ✭ 58 (+31.82%)
Mutual labels:  native, graalvm
micronaut-camunda-external-client
This open source project allows you to easily integrate Camunda's External Task Clients into Micronaut projects: simply add a dependency in your Micronaut project
Stars: ✭ 19 (-56.82%)
Mutual labels:  graalvm, micronaut
nxrocks
Set of Nx plugins to enhance your Nx workspace (even more!)
Stars: ✭ 165 (+275%)
Mutual labels:  micronaut, quarkus

Native Java Examples: Micronaut, Quarkus, Spring Boot, and Helidon

This 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.

This 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.

Prerequisites: Java 17 with GraalVM, HTTPie, and Docker (optional).

Getting Started

First, clone this repository:

git clone https://github.com/oktadev/native-java-examples.git

You will need a JDK with GraalVM and its native-image compiler. Using SDKMAN, run the following command and set it as the default:

sdk install java 22.1.0.r17-grl

Next, you'll need a free Okta developer account. Install the Okta CLI 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.

Use https://oidcdebugger.com/debug for the Redirect URI and accept the default Logout Redirect URI of https://oidcdebugger.com/.

Take note of the clientId and issuer values. You'll need those to get an access token and to configure each framework for JWT authentication.

Change the following files for each framework to match your Okta domain:

  • Micronaut: micronaut/src/main/resources/application.yml
  • Quarkus: quarkus/src/main/resources/application.properties
  • Spring Boot: spring-boot/src/main/resources/application.properties
  • Helidon: helidon/src/main/resources/META-INF/microprofile-config.properties

You 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.

  • Micronaut: ./mvnw mn:run
  • Quarkus: ./mvnw quarkus:dev
  • Spring Boot: ./mvnw spring-boot:run
  • Helidon: mvn package && java -jar target/helidon.jar

Then, you can test them with an access token and HTTPie.

You can generate an access token using OpenID Connect Debugger. First, you must configure your application on Okta to use OpenID Connect's implicit flow.

Run 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.

Now, navigate to the OpenID Connect Debugger website. 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.

Once you have an access token, set it as a TOKEN environment variable in a terminal window.

TOKEN=eyJraWQiOiJYa2pXdjMzTDRBYU1ZSzNGM...

Use HTTPie to pass the JWT in as a bearer token in the Authorization header.

http :8080/hello Authorization:"Bearer $TOKEN"

You should see your email address printed to your terminal.

You can also build and run each example as a native app.

  • Micronaut: ./mvnw package -Dpackaging=native-image
  • Quarkus: ./mvnw package -Pnative
  • Spring Boot: ./mvnw package -Pnative (if you'd rather use Docker: ./mvnw spring-boot:build-image)
  • Helidon: mvn package -Pnative-image

Then, start each app as a native executable.

  • Micronaut: ./target/app
  • Quarkus: ./target/quarkus-1.0.0-SNAPSHOT-runner
  • Spring Boot: ./target/demo (if Docker: docker run -p 8080:8080 demo:0.0.1-SNAPSHOT)
  • Helidon: ./target/helidon

Please read Build Native Java Apps with Micronaut, Quarkus, and Spring Boot for performance numbers and analysis. To see how Helidon compares, see Build REST APIs and Native Java Apps with Helidon.

Links

This example uses the following open source libraries:

Help

Please post any questions as comments on this example's blog post, or on the Okta Developer Forums.

License

Apache 2.0, see LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].