Coder Social home page Coder Social logo

kofa-yoh / spring-registration-login-social-demo Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 20 KB

User Registration and Login with Email and Password, Facebook and Google OAuth2

Java 82.09% CSS 6.29% HTML 11.63%
facebook-login google-login integration-testing java oauth2 registration spring-boot spring-security thymeleaf unit-testing email-and-password-authentication

spring-registration-login-social-demo's Introduction

User Registration and Login with Email and Password, Facebook and Google Demo

This sample application made with Spring Boot is intended to show simple user authentication and authorization using Spring Security.

On the login page user can sign up or log in with username (email) and password. After authentication user redirect on profile page where user can change credentials and log out the account. Also user can log in to the application by using existing account at an OAuth 2.0 Provider such as Facebook and OpenID Connect 1.0 Provider such as Google.

The application has unit and integration testing methods.

The frontend of the project (login form) is made with help of tutorial.

image

Stack

  • Java 17
  • Spring boot 3.2
  • Spring MVC
  • Spring Security
  • Spring Data JPA
  • Hibernate
  • Maven
  • Thymeleaf
  • HTML
  • CSS
  • JavaScript

Quick Start

1. Create database

I use PostgreSQL in this project, but you can choose another DBMS. Change the application settings connecting with using database.

# src/main/resources/config/application.properties
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=postgres
spring.datasource.password=admin
spring.datasource.driver-class-name=org.postgresql.Driver

2. Change port

# src/main/resources/config/application.properties
server.port=8081

3. Register application to use social networks for authentication

Uncomment and fill the application settings connecting with social networks.

# src/main/resources/config/application.properties
spring.security.oauth2.client.registration.facebook.client-id=xxx
spring.security.oauth2.client.registration.facebook.client-secret=xxx
spring.security.oauth2.client.registration.google.client-id=xxx
spring.security.oauth2.client.registration.google.client-secret=xxx

Tests

For unit and integration tests it is made the particular database 'mydb-test'. So you should create a database if you want to run the tests. The settings for application testing locate in the file: src/test/resources/application-test.properties

Useful Links

spring-registration-login-social-demo's People

Contributors

kofa-yoh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.