trackmcp
Back to directory
musabbozkurt

oauth2-authorization-server

View on GitHub

OAuth2 Authorization Server with Spring Boot 3 and Java 24

4 stars JavaServers & Infrastructure Updated Sep 10, 2025
ai-advisoraot-compilationarchunit-junit5coordinated-restore-at-checkpointdockerflywayjava-24mapstructmariadbmcp-clientmcp-serveroauth2-authorizationserverollamaredisretrieval-augmented-generationspring-boot-3spring-securityspringdoc-openapitestcontainersvector-database

Documentation

OAuth2 Authorization Server with Spring Boot 4 and Java 26

Prerequisites

  • Java 26 should be installed --> `export JAVA_HOME=$(/usr/libexec/java_home -v 26)`
  • Maven should be installed
  • Docker should be installed
  • Postman can be installed

How to Run and Test

  • Run the following commands to set environment variables for AI model API keys

    export OPENAI_API_KEY=your_api_key_here

    export DEEPSEEK_API_KEY=your_api_key_here

    export ANTHROPIC_API_KEY=your_api_key_here # Optional

    export GOOGLE_GENAI_API_KEY=your_api_key_here # Optional

    code
    - ```bash
        cd oauth2-authorization-server
        
        # Run tests on the host (requires Docker for Testcontainers)
        mvn clean verify
        
        # Build and start the application together with all infrastructure services
        docker compose --profile start_application up -d --build
        
        # Start only infrastructure services (Redis, MariaDB, LDAP, Ollama, etc.)
        docker compose up -d
        
        # For local development without Docker (requires infrastructure services running via docker compose up -d)
        ./mvnw spring-boot:run   # or: mvn spring-boot:run
    • Import the followings to test in Postman
      • Swagger: http://localhost:9000/swagger-ui/index.html
        • Actuator: http://localhost:9000/actuator/
        • Database credentials
          • Redis
            • Redis Insight: http://localhost:5540/
              • Ollama
                • Grafana UI

                  Debugging Spring Boot Tests in IntelliJ IDEA

                  1. Run one of the below commands in the terminal

                    2. Open IntelliJ IDEA

                    3. Go to `Run > Attach to Process` (or use shortcut)

                      4. Select the Java process running your tests

                      5. The test will pause until you connect your debugger. Once connected, you can use breakpoints and step through your

                      code.

                      How to Run and Test with CDC (Class Data Sharing)

                      • Java 26+ should be installed
                      • Run `./mvnw clean install` or`./mvnw clean install -Paot` or `./mvnw -Paot package` command to build the application

                      with AOT

                      • Run `docker-compose up -d` command to run necessary services
                      • Run `docker build -t oauth2-authorization-server -f DockerfileForAOTCache .` command to build the image
                      • Run `docker run -d --restart=always -p 9000:9000 oauth2-authorization-server:latest` command to run the image

                      How to Run and Test Native Image with GraalVM

                      • Java 26 GraalVM edition should be installed
                      • Run `docker-compose up -d` command to run necessary services
                      • Run `./mvnw -Pnative native:compile` or `./mvnw -Pnative native:compile -DskipTests` command to build the native image
                      • Run `./target/oauth2-authorization-server` command to run the native image
                      • Install Grype (OPTIONAL)
                        • Run `native-image-inspect ./target/oauth2-authorization-server-0.0.1 >output.json` command and open `output.json` or

                        visit http://localhost:9000/actuator/sbom/native-image to inspect all libraries, methods etc. used in the native image

                        • Run `open ./target/oauth2-authorization-server-build-report.html` to see build report
                        • Use Swagger UI to test the application

                        Spring Boot with CRaC (Coordinated Restore at Checkpoint) by Creating Ready to Restore Container Image.

                        • Warning: for real projects make sure to not leak sensitive data in CRaC files since they contain a snapshot of the

                        memory of the running JVM instance.

                        • Checkpoint

                          on demand checkpoint/restore of a running application

                          with: `./docs/scripts/checkpoint.sh`

                            an automatic checkpoint/restore at startup

                            with: `./docs/scripts/checkpointOnRefresh.sh`

                            • Restore
                              • Use Swagger UI to test the application

                              How to Run and Test AI Models Locally with Docker Desktop Model Runner

                              • Requires: Docker Desktop 4.40 and later
                              • Run `docker-compose up -d` command to run necessary services
                              • Run `docker model pull ai/gemma3:4B-Q4_K_M` command to pull the model
                                • `Docker Desktop` --> `Settings` --> `Features in development` --> `Beta features` --> `Enable Docker Model Runner` -->

                                `Enable host-side TCP support` --> `Apply & Restart`

                                Docker_Desktop_Enable_Host_Side_TCP_Support.png
                                • Run `mvn test` or `mvn clean install` or `mvn clean package` or `./mvnw clean install` command to run all the tests
                                • Run `mvn spring-boot:run` command to run the application
                                • Use Swagger UI to test the application

                                Dependency Version Management

                                Dependency versions are managed via

                                the Maven Versions Plugin and a `version-rules.xml` filter

                                that excludes alpha/beta/RC/SNAPSHOT releases.

                                Local — using the helper script:

                                bash
                                ./docs/scripts/update-versions.sh check           # Show all outdated versions (parent + props + deps + plugins)
                                ./docs/scripts/update-versions.sh update          # Auto-update everything and review with: git diff pom.xml
                                ./docs/scripts/update-versions.sh update-props    # Update only  versions (safest)
                                ./docs/scripts/update-versions.sh update-parent   # Update only spring-boot-starter-parent
                                ./docs/scripts/update-versions.sh revert          # Revert pom.xml from backup

                                CI/CD — automated PR creation:

                                The MB Dependency Version Update workflow runs every Monday (and on-demand),

                                checks for updates, verifies the build compiles, and creates a PR automatically.

                                References

                                Frequently asked questions

                                What is oauth2-authorization-server?

                                oauth2-authorization-server is OAuth2 Authorization Server with Spring Boot 3 and Java 24

                                How do I install oauth2-authorization-server?

                                Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

                                Is oauth2-authorization-server open source?

                                Yes — it is hosted on GitHub at https://github.com/musabbozkurt/oauth2-authorization-server and has 4 stars.

                                Related MCP tools

                                Run your own MCP server? See who uses it and what to fix.

                                Measure it with TrackMCP