This project is a demo application demonstrating the integration of Spring Security with OAuth2 using GitHub as the authentication provider. The project uses Spring Boot for rapid development and ease of setup.
- Getting Started
- Prerequisites
- Installation
- Running the Application
- Configuration
- Built With
- Contributing
- Authors
- License
These instructions will help you set up and run the project on your local machine for development and testing purposes.
- Java 17
- Maven 3.6.3 or higher
- A GitHub account
-
Clone the repository
git clone https://github.com/pwnmahto/Spring-Security-Oauth2-Github.git cd Spring-Security-Oauth2-Github
-
Configure GitHub OAuth2 credentials
- Create an OAuth2 application in your GitHub account.
- Set the callback URL to
http://localhost:8080/login/oauth2/code/github
. - Note the Client ID and Client Secret provided by GitHub.
-
Update application.properties
- Open
src/main/resources/application.yml
. - Add your GitHub Client ID and Client Secret:
spring: security: oauth2: client: registration: github: client-id: <!-- CLIENT ID --> client-secret: <!-- CLIENT SECRET -->
- Open
To run the application, execute the following command:
mvn spring-boot:run
The application will start and be accessible at http://localhost:8080
.
The project uses the following dependencies:
spring-boot-starter-oauth2-client
: Provides OAuth2 client support.spring-boot-starter-security
: Provides security features.spring-boot-starter-web
: Provides web application support.spring-boot-devtools
: Provides development tools.lombok
: Reduces boilerplate code with annotations.spring-boot-starter-test
: Provides testing support.spring-security-test
: Provides testing support for Spring Security.
- Spring Boot - Framework for building production-ready applications.
- Maven - Dependency management.
Contributions are welcome! Please fork the repository and create a pull request.
- Pawan Kumar - pwnmahto
This project is licensed under the MIT License - see the LICENSE file for details.