https://github.com/andrzejszelag/oauth2githubssl
A Spring Boot web application configured to use OAuth 2.0 with GitHub API and self-signed SSL certificate.
https://github.com/andrzejszelag/oauth2githubssl
github-api gradle oauth2 spirng-boot spring-security ssl-certificates thymeleaf tomcat10 visual-studio-code
Last synced: 2 days ago
JSON representation
A Spring Boot web application configured to use OAuth 2.0 with GitHub API and self-signed SSL certificate.
- Host: GitHub
- URL: https://github.com/andrzejszelag/oauth2githubssl
- Owner: AndrzejSzelag
- Created: 2025-03-02T14:28:27.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-14T16:05:01.000Z (5 months ago)
- Last Synced: 2025-12-17T01:23:05.694Z (5 months ago)
- Topics: github-api, gradle, oauth2, spirng-boot, spring-security, ssl-certificates, thymeleaf, tomcat10, visual-studio-code
- Language: Java
- Homepage: https://github.com/AndrzejSzelag/oauth2githubssl
- Size: 295 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OAuth 2.0 GitHub SSL
[](https://en.wikipedia.org/wiki/Self-signed_certificate)
[](https://docs.github.com/en/rest)
[
](https://oauth.net/2/)
[
]()
[
](https://gradle.org/)
[
](https://www.thymeleaf.org/)
[
](https://www.sonarsource.com/products/sonarqube/)
### A Spring Boot web application configured to use OAuth 2.0 with GitHub API and self-signed SSL certificate.


### Tech Stack
* 🔶 Java 21.0.5 LTS
* 🔶 Spring Boot 3.4.3
* 🔶 Gradle 8.12.1
* 🔶 Apache Tomcat 10.1.36
* 🔶 SonarQube 4.0.0.2929
### IDE
* 🔶 Visual Studio Code 1.98.2
#### What is OAuth 2.0?
OAuth (Open Authorization) 2.0 is an open authorization standard. It provides a way for users to log into a web-based
application (Spring Security OAuth 2.0) by delegating the authentication process to trusted third-party services, such
as Google and GitHub. The full specification of the OAuth 2.0 protocol can be found
in [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749).
#### How use OAuth2.0?
1. Clone a GitHub Repository to your computer:
git clone https://github.com/AndrzejSzelag/oauth2githubssl.git
2. Configuring an **OAuth 2.0 GitHub SSL** application in **GitHub** (https://github.com/: Settings -> Developer settings).
You need:
CLIENT_ID
CLIENT_SECRET
**Warning:**
These values should be set in the **application.yml** file in place of **CLIENT_ID** and **CLIENT_SECRET**.
### Self-Signed SSL Configuration (Required for HTTPS)
This application uses a self-signed SSL certificate for development and testing purposes with HTTPS. Since the private key file (`keystore.p12`) is excluded from the repository (via `.gitignore` for security reasons), you must generate your own local key before running the application.
### 1. Generate the Keystore File
Execute the following command in the project's root directory. This requires **Java Development Kit (JDK)** to be installed, as it uses the `keytool` utility.
```bash
keytool -genkeypair -alias oauth2githubssl-key -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore src/main/resources/keystore.p12 -validity 3650
```
* **Crucial Step**: When prompted for **"First and last name"** (**What is your first and last name?**), you must enter **localhost**. This is required for the browser to trust the certificate for local development.
* **Password**: Use a secure password (e.g., ```haslo1234```) and remember it for the next step.
### 2. Configure the Application Properties
After generating the ```keystore.p12``` file, ensure your **src/main/resources/application.properties** file contains the following configuration, making sure to replace the placeholder password with the one you chose during generation:
server.port=8443
server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=haslo1234
server.ssl.key-alias=oauth2githubssl-key
### To run a Spring Boot project using Gradle from the command line, follow these steps:
* Open a terminal in the project's root directory.
* Execute the command:
gradle bootRun
* Paste the URL into your web browser:
http://localhost:8080
❤️ You have successfully run the Spring Boot project using Gradle!