- generate google-oauth client-id and client-secret
- generate github-oauth client-id and client-secret
Note: After generating the above tokens place it in
src/main/resources/application.properties
- The starting point of the application is
src/main/java/com/development/SpringOAuthApplication/SpringOAuthApplication.javathat runs the spring boot application. - There is one rest-controller defined in
src/main/java/com/development/SpringOAuthApplication/controller/Controller.javathat lands to thehttp://localhost:8080/and prints Hello. - The configuration for authentications are defined in
src/main/java/com/development/SpringOAuthApplication/config/WebSecurityConfig.javafor the OAuth2 login as well as Form Based login. - The
UserDetailsServiceis defined insrc/main/java/com/development/SpringOAuthApplication/config/WebSecurityConfig.javathat adds the user for the login with username:user and password:password.
To run the application, type mvn spring-boot:run on terminal
The application will be accessible at http://localhost:8080 and redirected to the login page at http://localhost:8080/login
Note: To run the application in debug mode add
debug=trueinsrc/main/resources/application.properties