Skip to content

musabbozkurt/oauth2-authorization-server

Repository files navigation

OAuth2 Authorization Server with Spring Boot 3 and Java 23

Prerequisites

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

How to Run and Test

  • Run export DEEPSEEK_API_KEY=your_api_key_here command to set DeepSeek API key
  • Run docker-compose up -d command to run necessary services
  • 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
  • Import the followings to test in Postman
  • Swagger: http://localhost:9000/swagger-ui/index.html
    • Click Authorize and enter the following credentials
    • client_id: client
    • client_secret: secret
    • Use one of the following default values to log in http://localhost:9000/login
      • username: Developer password: password
      • username: Admin password: password
      • username: User password: password
  • Database credentials
    • url: jdbc:mariadb://localhost:3306/oauth2_authorization_server
    • username: mb_test
    • password: test
  • Ollama
    • http://localhost:3000/ sign up for an account for local environment
    • Search for deepseek-r1:7b and download it if it does not exist

Debugging Spring Boot Tests in IntelliJ IDEA

  1. Run one of the below commands in the terminal
    • mvn test -Dmaven.surefire.debug
    • If port 5005 is already in use, you can specify a custom port
      • mvn test -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
  2. Open IntelliJ IDEA
  3. Go to Run > Attach to Process (or use shortcut)
    • Windows/Linux: Ctrl + Alt + 5
    • Mac: Cmd + Alt + 5
  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.

References

Releases

No releases published

Packages

No packages published

Languages