In real projects, you may encounter some cases where the application needs to use two different login methods depending on the user’s role, for example, there are applications that will need normal users to login using tokens or QR code, and admin login using username and password. How to implement multiple login pages using Spring Security? I will guide you in this sample.
- Clone the repository:
git clone https://github.com/hendisantika/spring-boot-multiple-security-config.git
- Navigate to the folder:
cd spring-boot-multiple-security-config
- Run the application:
mvn clean spring-boot:run
- Open your favorite browser: http://localhost:8080/user/view
- Open your favorite browser: http://localhost:8080/admin/view
- Use these users:
user/user
oradmin/admin
User Login
User Page
Admin Page